In SQL Server 2000, the default database, when changed (for example, from master to db1 for user sa) would be the database that would be active when you opened a Query Analyzer query window. Now, with the Management Studio, if you log in as sa with the default database set to db1, you still get server.master as your database in the embedded query editor. Also, consistent with this behavior, if I open the Query Analyzer and log onto the new SQL Server 2005 database (not recommended, I know, but works), it does the same thing. Again, in 2000, if you changed the default database, the Query analyzer would open a window starting at server.db1, not server.master. Am I missing something in 2005 to make this same default behavior work? ALSO, when logging into the Management Studio with sa (new default DB set), the connection properties of the Studio shows the DB to be master! What gives?
I am able to change the database, bring up the query editor and it shows (servername.databasename). Also I tried to connect to the server using SQLNCLI provider (through VB6/ADO) and got the right database name
Dim cn As New ADODB.Connection
cn.Open "Data Source=<servername>;Provider=SQLNCLI;User ID=<username>;Password=<password>;"
MsgBox cn.DefaultDatabase
cn.Close
Changed the database name through (SQL Management Studio UI) : Security -> Logins -> Right Click on Login -> Properties (Change the default database to what you want from the drop down)
Are you doing anything different?
|||
If i recollect correctly.... this problem was there in SQL Server 2005 sp1. In sp2 it was resolved. pse post back the version /edition/service pack of this box
Madhu
sql
No comments:
Post a Comment