This post has been migrated from www.experimentsincode.com, we apologise if some of the images or content is missing
USE databaseName; GO EXEC sp_change_users_login 'Auto_Fix', 'username', NULL, 'password'; GOIf the user already has a logon to the SQL box then it will just link the database user to that login, otherwise it creates a new user with the username and password specified.