Assign user and permissions to SQL DB by means of Script

0

Performing a migration of numerous databases, we need to assign a Windows user and its permissions to each of the restored databases.

Could this be done by means of a scritp? In this way you would avoid repeating the same process so many times.

The user to add is the network user for services, NETWORK (Windows User).

    
asked by Adso4 29.05.2017 в 12:10
source

1 answer

0

This has worked for me:

USE [DDBB_NAME]
GO
CREATE USER [USER_NAME] 
GRANT 
ALTER, CONNECT,CREATE TABLE, DELETE, 
EXECUTE, INSERT, SELECT, UPDATE
ON DATABASE::[DDBB_NAME] TO [USER_NAME]
    
answered by 08.06.2017 / 10:19
source