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

change the default database Expand / Collapse
Author
Message
Posted Wednesday, September 4, 2013 11:11 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 5:30 PM
Points: 33,055, Visits: 15,167
Show how to change this, in T-sql and ssms, for a login. Say a sysadmin to get them out of master.






Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1491449
Posted Wednesday, September 4, 2013 12:09 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 2:32 PM
Points: 13,067, Visits: 11,903
This isn't exactly worth an article. It is nothing more than a single command (t-sql) and a single screen shot to use the UI.

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1491473
Posted Wednesday, September 4, 2013 12:20 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, June 17, 2014 8:28 PM
Points: 68, Visits: 142
This seems simple enough to be a good starting point for me to contribute to the SSC community.
I can take this one, Steve, if you'd like.

Sean: I think even basic articles have value; we have so many people worldwide seeking the most basic of basic knowledge.

Post #1491476
Posted Wednesday, September 4, 2013 12:28 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 2:32 PM
Points: 13,067, Visits: 11,903
markjholmes (9/4/2013)
This seems simple enough to be a good starting point for me to contribute to the SSC community.
I can take this one, Steve, if you'd like.

Sean: I think even basic articles have value; we have so many people worldwide seeking the most basic of basic knowledge.



I absolutely agree that basic knowledge is important to share. The topic and the information is extremely valuable (especially when you need to know the answer right now because production is having issues). I was merely asking if this topic is large enough for even a spackle, let alone an article.


_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1491478
Posted Wednesday, September 4, 2013 1:33 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 5:30 PM
Points: 33,055, Visits: 15,167
It absolutely is. How many people do you think don't know where to check this? Don't recognize the error? It's not long, but it is worth a few paragraphs, the code, and some images.

I would probably do it in 30 minutes tops, but wanted to offer it out there.

There are lots of people that don't understand what this means or how to fix it.







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1491510
Posted Thursday, September 5, 2013 7:56 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 9:54 PM
Points: 36,722, Visits: 31,171
In that case, I think Mark should write it and Sean, being a new member of the 10K club, should review it and help guide Mark to his first "Spackle" article.

What say yea Gentlemen?


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1492021
Posted Friday, September 6, 2013 7:36 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 2:32 PM
Points: 13,067, Visits: 11,903
Jeff Moden (9/5/2013)
In that case, I think Mark should write it and Sean, being a new member of the 10K club, should review it and help guide Mark to his first "Spackle" article.

What say yea Gentlemen?


Sure I'm good with that. Good idea Jeff.


_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1492233
Posted Friday, September 6, 2013 9:12 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 9:54 PM
Points: 36,722, Visits: 31,171
Mark, meet Sean. Sean, meet mark.

Mark... you're on.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1492295
Posted Friday, September 6, 2013 11:25 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 4:09 PM
Points: 3,121, Visits: 11,395
It might be more valuable if you explained the implications of changing the default database, and especially the disadvantages of having a default database that is not master for an admin login.

Other wise, the article could be one line:
exec sp_defaultdb N'MyDomain\MyLogin', N'MyDatabase'

Post #1492348
Posted Friday, September 6, 2013 12:05 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 2:32 PM
Points: 13,067, Visits: 11,903
Michael Valentine Jones (9/6/2013)
It might be more valuable if you explained the implications of changing the default database, and especially the disadvantages of having a default database that is not master for an admin login.

Other wise, the article could be one line:
exec sp_defaultdb N'MyDomain\MyLogin', N'MyDatabase'



Thanks for validating that this really does deserve an article. That proc is deprecated in favor of ALTER LOGIN.


_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1492353
Posted Friday, September 6, 2013 1:08 PM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 4:09 PM
Points: 3,121, Visits: 11,395
Sean Lange (9/6/2013)
Michael Valentine Jones (9/6/2013)
It might be more valuable if you explained the implications of changing the default database, and especially the disadvantages of having a default database that is not master for an admin login.

Other wise, the article could be one line:
exec sp_defaultdb N'MyDomain\MyLogin', N'MyDatabase'



Thanks for validating that this really does deserve an article. That proc is deprecated in favor of ALTER LOGIN.


You could just change the article to:
 -- Works with any version
exec sp_defaultdb N'MyDomain\MyLogin', N'MyDatabase'

-- Works with SQL 2005 and later
ALTER LOGIN [MyDomain\MyLogin] with DEFAULT_DATABASE = [MyDatabase] ;


Post #1492386
Posted Friday, September 6, 2013 1:31 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 2:32 PM
Points: 13,067, Visits: 11,903
Michael Valentine Jones (9/6/2013)
Sean Lange (9/6/2013)
Michael Valentine Jones (9/6/2013)
It might be more valuable if you explained the implications of changing the default database, and especially the disadvantages of having a default database that is not master for an admin login.

Other wise, the article could be one line:
exec sp_defaultdb N'MyDomain\MyLogin', N'MyDatabase'



Thanks for validating that this really does deserve an article. That proc is deprecated in favor of ALTER LOGIN.


You could just change the article to:
 -- Works with any version
exec sp_defaultdb N'MyDomain\MyLogin', N'MyDatabase'

-- Works with SQL 2005 and later
ALTER LOGIN [MyDomain\MyLogin] with DEFAULT_DATABASE = [MyDatabase] ;




Which was exactly why I asked in my first post if it was enough of a subject. I think a few paragraphs explaining what happens to a login when the default db has been dropped etc could prove to be pretty useful. Just have to think a bit past the exact syntax and explain the why you would need it.


_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1492396
Posted Friday, September 6, 2013 2:34 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, June 17, 2014 8:28 PM
Points: 68, Visits: 142
Yup, it looks like this is a topic of interest.
I'll get a decent quality yet small article written up tonight most likely.

Post #1492423
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse