Friday, January 16, 2015

script:User Permission

The following script  creates a new user and lets the user create new objects and grant permission on the objects to other users


IF EXISTS (SELECT * FROM sys.database_principals WHERE name = N'user1')

DROP USER [user1]

create user [user1] for login [domain\user1]

EXEC sp_addrolemember db_ddladmin, [user1]; -- allows to create objects

EXEC sp_addrolemember db_securityadmin, [user1]; --allows to assign permission on objects

No comments:

Post a Comment