Attach Database Without Logins
I was recently taking a SQL Server 2000 database and moving it over into SQL Server 2005. I did it the old fashioned way and unfortunately the login that our application used to access the DB wasn't in the new SQL Server. I was silly and tried adding the login to that server instance. Fine. Authentication with the DB still didn't work though and as many of you know, when I went to then delete the login from the DB itself I couldn't. In SQL Server 2005 there is a system SP to call to automatically fix this. Here's what I called...
EXEC sp_change_users_login 'auto_fix', 'myLogin'
That's it and everything was peachy again. A lot of you have seen this already I'm sure, but for those of you who haven't, hope it saves you time. This entry is mostly just so I remember it. ;)