Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
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: Thursday, June 2, 2016 7:55 AM
Points: 30, Visits: 274
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: Today @ 9:05 AM
Points: 14,407, Visits: 37,679
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

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!
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: Thursday, June 2, 2016 7:55 AM
Points: 30, Visits: 274
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: Today @ 9:05 AM
Points: 14,407, Visits: 37,679
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

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!
Post #1385842
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse