Click here to Skip to main content
15,848,415 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a list of databases in the server and one i have one login as "Testuser". Testuser have different set of privilege for every database.
I need a user Testuser2 to be created in the database with the same privilege as Testuser. Is thr any specific sql script in sql sevrer ?

What I have tried:

I have a list of databases in the server and one i have one login as "Testuser". Testuser have different set of privilege for every database.
I need a user Testuser2 to be created in the database with the same privilege as Testuser. Is thr any specific sql script in sql sevrer ?
Posted
Updated 12-Apr-18 8:50am

Perhaps the easiest way is to use Object Explorer in Management Studio
- Connect to your database
- In Security / Logins branch select the login you want and open the context menu
- Select Script login as / Create to / New query editor
- Expand the database you use
- In your database select Security / Users
- and again Script the user

If you need to use a script to transfer login, you can find one for example at Script All Logins / Users / and Roles - SQLServerCentral[^]
 
Share this answer
 
v2
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900