SP_Change_Users_Login
I am moving several databases that belongs to a single application from MSSQL2000 to MSSQL2005. After sucessfully moved and converted the databases I need to fix the users login and I am using sp_change_users_login procedure to do so. My questions are: I have an application user that needs to be fixed in several databases - how can I fixed the login all once? Also is there a way to turned the check_policy off at the same time I fixed the logins?
thank you
[592 byte] By [
Pereira] at [2008-1-9]
If I understand the problem, you have the same user (i.e. the SID is the same) on all databases, correct? You can find the SID using the following query:
SELECT sid FROM sys.database_principals WHERE name = 'user_name'
And then create a login with the corresponding SID and the password policy setting you need, for example:
CREATE LOGIN [login_name]
WITH PASSWORD = 'password',
CHECK_POLICY = OFF,
SID = 0x<SID_IN_BINARY_FORMAT>
Because the users are mapped to logins via the SID, all database users that are mapped to the same login will be fixed.
Please let us know if this information helped or if you have any additional questions.
Thanks,
-Raul Garcia
SDE/T
SQL Server Engine