Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
hebegb
Starting Member
2 Posts |
Posted - 2004-12-14 : 11:06:38
|
GreetingsIn the process of moving a db from one server to another. I transfered logins using sp_help_revlogin. Nowis I need to change the 324 users default db from master to the moved DB.I cannot recall or find how to script all these users to there default db. I know it involves sp_defaultdb.Thanks |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2004-12-14 : 11:38:27
|
This should get you started:SELECT 'exec sp_defaultdb ''' + COALESCE(name,QUOTENAME(loginname)) + ''', ''newdb''', * FROM master..sysloginsThat will generate the SQL needed to actually set the DB. Copy the results of that into a new query window, edit as needed, then run it. |
 |
|
hebegb
Starting Member
2 Posts |
Posted - 2004-12-14 : 12:05:57
|
Thanks that is exactly what I needed... |
 |
|
|
|
|