June 25, 2009 at 6:14 am
Hi,
Is anyone know that what is the behind work of "Use" function. we could use this "Use" command to change the database. Is there any other way to change the database in sql server other than the short cut key. If please let me know. If you find that info in any of the website please let me know the link..
Thanks in advance
Pras
June 25, 2009 at 6:23 am
I'm not sure what you are looking for.
* You can use "USE" to change database by T-SQL
* You can use your mouse to change database by select another in databases combo-box
* You can use CTRL-U to select another database by shortcut
* You can use SQLCMD scripts to dynamically specify database name
Which input type is missing?
June 25, 2009 at 7:14 am
If you want, you can query between databases by qualifying the database objects with the db name? Is that what you're looking for? Otherwise, you have to switch databases to switch databases and the USE statement is the correct TSQL syntax for doing it.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
June 25, 2009 at 10:22 pm
by default for every new connection the master database is opened and then we use "USE " to go to a particular database .
The other way could be to change the default database of the user connecting to SQL Server to a user database .
Regards
Abhay Chaudhary
Sr.DBA (MCITP/MCTS :SQL Server 2005/2008 ,OCP 9i)
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply