Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Switching Databases

Status
Not open for further replies.

sshafe

Programmer
Oct 18, 2002
71
US
I have written a script that loops through a list of SQL Server machines, then the databases inside of the server, then tables. Problem is that I'm currently just using a "use database" command to change to the next database, but for some reason it's not working. I get the message

[Microsoft][ODBC SQL Server Driver][SQL Server]Changed database context to 'tempdb'.
(Source: Microsoft OLE DB Provider for ODBC Drivers)
(SQL State: 01000)
(NativeError: 5701)
No Help file available

that it's changed, but right after that statement I do a select SELECT DB_NAME() AS DatabaseName and display it and the database has not changed.

Any ideas???

Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top