Add role member : sp_addrolemember « System Functions « SQL Server / T-SQL Tutorial






2>
3> IF EXISTS(SELECT * FROM sys.tables
4>     WHERE name = 'TrackPersons' AND schema_id = 1)
5>     DROP TABLE dbo.TrackPersons
6> IF EXISTS(SELECT * FROM sys.tables
7>     WHERE name = 'TrackPersons' AND schema_id = 5)
8>     DROP TABLE sqllogin3.TrackPersons
9> GO
1>
2> EXEC sp_addrolemember 'db_ddladmin', 'sqllogin4'
3> GO
1>
2> EXECUTE AS login = 'sqllogin4'








25.20.sp_addrolemember
25.20.1.How to assign a user to a database role
25.20.2.A statement that assigns a user to a database role
25.20.3.Statements that assign users to the new role
25.20.4.A statement that assigns the new role to a fixed database role
25.20.5.Add role member