Hi there,
I often have to run multiple SQL scripts against a single database. SQL Server Management Studio always reverts the selected database to Master whenever I open a different SQL file. This requires me to re-select the correct database, and if I forget, I end up running the script against the Master database. SQL 2000's query analyzer "remembered" your selected database and did not force you to re-connect each time.
Is there any way to make SQL Server Management Studio act this way?
Thanks!
Kiron
Kiron,
You could set the default database for the sql login. so that the default DB will be selected automatically.
To set default databasefor a sql login, In Object Explorer, expand Security -> Logins
right click on login , properties, set the default database
After setting default DB for the SQL login, if you open up new query with the above mentioned login, you would see the default database selected
If you feel that the above solution does not meet your requirements, Please log a feature request in connect web site
https://connect.microsoft.com/SQLServer/Feedback
Thanks
Sethu Srinivasan, Software Design Engineer, SQL Server Manageability
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
Hi Sethu -
thanks for the response. Unfortunately, this will reset the default database, as opposed to having the new query session just "remember" the database that was selected for other open query sessions. Ideally, I would want the same behavior as in Query Analyzer from 2000 - you connect once to the database and from then on, all query windows are assumed to be related to the same database.
As part of my work, I often have to open multiple SQL scripts and execute them against the same database - the database is never the same, hence, the default database approach will merely shift the issue from "master" to some other database. What I would need is an option to tell Management Studio to pick the database that is used by all open query windows as the default when a new query window is opened vs. picking the user's default database.
I'll log a feature request as suggested!
Thanks again!
Kiron
No comments:
Post a Comment