Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

sp_defaultdb not working Expand / Collapse
Author
Message
Posted Friday, November 16, 2012 11:10 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Yesterday @ 8:26 AM
Points: 27, Visits: 198
Hi all,

New query windows always open in the master database. I have sysadmin rights on the system. I have selected an alternate database with both sp_defaultdb and the GUI. Both appear to work fine. But when I open a new window it's always in the master database.

BTW we have several SS2005 servers and this works fine on those. Its just this one machine that insists on taunting me.

Any ideas would be appreciated.
Post #1385794
Posted Friday, November 16, 2012 11:58 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 2:33 PM
Points: 12,953, Visits: 32,483
you probably never notice, but SSMS builds a default connection string that points to a specific database, like master, unless you selected or left <default> in place , so unless you change it, no matter what your default database is, SSMS will dump you into master;

that overrides whatever database is your default database.

on the credentials screen if you click on the Options>> button, you can click options and change it to a default database there.




Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #1385816
Posted Friday, November 16, 2012 12:15 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Yesterday @ 8:26 AM
Points: 27, Visits: 198
Lowell,

The image did not post at first so I was confused. A second loading of the page produced the image and answered all my questions. Your suggestion worked perfectly. Thanks for taking the time to post an image as they really are worth a 1000 words!

Thanks again!
Post #1385823
Posted Friday, November 16, 2012 1:22 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 2:33 PM
Points: 12,953, Visits: 32,483
man you must be quick!
i posted my answer, and noticed i left of the .png on the image name and fixed it right away...

glad i could help!


Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #1385842
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse