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 |
|
fqiao70
Yak Posting Veteran
52 Posts |
Posted - 2003-04-25 : 11:04:04
|
| could anyone tell me the steps how to move a database completely from one server to another server? I did detach, and then copy the data file and the log file, and then attach them to a new server. but all users were missing. I know I can use sp_change_users_login 'update_one' to get each user back, but I have over 20 users. how can I do it???Please help me, Thank You!!Feng |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2003-04-25 : 11:26:55
|
| execute that proc 20 times ...(or write a proc to execute that proc once for each user)Jay White{0} |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-04-25 : 12:30:36
|
quote: execute that proc 20 times ...(or write a proc to execute that proc once for each user)
OR...Run this once in QA (make sure you are pointing to the correct user database though):SET QUOTED_IDENTIFIER OFFGODECLARE @SQL varchar(100)DECLARE curSQL CURSOR FOR select "exec sp_change_users_login 'AUTO_FIX','" + name + "'" from sysusers where issqluser = 1 and name NOT IN ('dbo', 'guest')OPEN curSQLFETCH curSQL into @SQLWHILE @@FETCH_STATUS = 0BEGIN EXEC (@SQL)-- SELECT @SQL FETCH curSQL into @SQLENDCLOSE curSQLDEALLOCATE curSQLgoThe passwords will be blank though after you run this query. I have posted a solution on how to transfer passwords also, so do a search on isp_Transfer_Logins (use the Forum search option).TaraEdited by - tduggan on 04/25/2003 12:34:25 |
 |
|
|
AjarnMark
SQL Slashing Gunting Master
3246 Posts |
|
|
fqiao70
Yak Posting Veteran
52 Posts |
|
|
|
|
|