sp_change_users_login 'problems'
-
Hi there, Hope someone can help me, I'm trying to resolve orphaned users in SQL server. I created a procedure that works very nice in SQL server 2005, but it's having problems in SQL server 2000. Here is the problem part of my code: create table #Users( username varchar(20), userId varchar(250)) insert into #Users exec sp_change_users_login 'Report' select * from #Users Then I get this error: Server: Msg 15289, Level 16, State 1, Procedure sp_change_users_login, Line 27 Terminating this procedure. Cannot have an open transaction when this is run. Hope you can help. Thank you :)
-
Hi there, Hope someone can help me, I'm trying to resolve orphaned users in SQL server. I created a procedure that works very nice in SQL server 2005, but it's having problems in SQL server 2000. Here is the problem part of my code: create table #Users( username varchar(20), userId varchar(250)) insert into #Users exec sp_change_users_login 'Report' select * from #Users Then I get this error: Server: Msg 15289, Level 16, State 1, Procedure sp_change_users_login, Line 27 Terminating this procedure. Cannot have an open transaction when this is run. Hope you can help. Thank you :)
Hi again, Ok, I'm going to post my own fix on this :P But would still like ideas on the original problem, if someone has. I basically just did what the SP did in a short query: select name AS UserName, sid AS UserSID from sysusers where issqluser = 1 and (sid is not null and sid <> 0x0) and suser_sname(sid) is null order by name Kind regards