-- This will report the orphan users. sp_change_users_login @Action = 'action' -- This will fix the orphan users. e.g This mapps the user "MyUser" to the login "MyUser". EXEC sp_change_users_login @Action = 'Update_One', @UserName = 'MyUser', @LoginName = 'MyUser' -- Execute the following query in "Result to text mode" (ctrl+ T) to genrate script for fixing the orphan users. copy the results and run in new window. SET NOCOUNT ON USE MyDB GO select 'EXEC sp_change_users_login @Action = ''Update_One'', @UserName = '''+name+''', @LoginName = '''+Name+''''+CHAR(10)+'GO' from sysusers where issqluser = 1 and (sid is not null and sid <> 0x0) and (len(sid) <= 16) and suser_sname(sid) is null order by name
13 People are following this question.