Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

domain conversion and logins and users Expand / Collapse
Posted Wednesday, August 08, 2012 6:46 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Tuesday, February 18, 2014 12:52 PM
Points: 502, Visits: 750
I have a sql 2005 server that supports a 3rd party app. Users connect with win/sql authentication, the 3rd party app then has an interface to add the users to the database. In sql logins you see
mydomain\myname. In the users in the database you only see myname. We are converting domains, which means I need to script out all logins and users. The trick is now the login will be
newdomainame\myname. The usernames in the database could stay the same but would be mapped to the old logins. At the login level I know how to script them all out and then do a quick replace with the new domain name. The trick is the users and either scripting them out out making sure when the logins go back in that they are mapped to the correct users. Any ideas on how to handle this?

Post #1341824
Posted Thursday, August 16, 2012 2:24 PM



Group: General Forum Members
Last Login: Wednesday, April 16, 2014 9:25 AM
Points: 7,070, Visits: 12,523
No need to script them out. You can generate a command like this for each user with the new login for each. Just make sure you supply the NAME option and reiterate the name you want for the user otherwise SQL Server will rename the user to the new login name:

ALTER USER [User.Name] WITH LOGIN = [NEWDOMAIN\User.Name], NAME = [User.Name];

There are no special teachers of virtue, because virtue is taught by the whole community. --Plato

Believe you can and you're halfway there. --Theodore Roosevelt

Everything Should Be Made as Simple as Possible, But Not Simpler --Albert Einstein

The significant problems we face cannot be solved at the same level of thinking we were at when we created them. --Albert Einstein

1 apple is not exactly 1/8 of 8 apples. Because there are no absolutely identical apples. --Giordy
Post #1346237
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse