sp_defaultdb not working

  • 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.

  • 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!

  • 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! 😀

  • 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!

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply