17.07.2015 Views

Download eBook (PDF) - Red Gate Software

Download eBook (PDF) - Red Gate Software

Download eBook (PDF) - Red Gate Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2 – Data Classification and RolesListing 2-3 creates the database users for our sample database. Please note thatin order to successfully execute this script your login account will need to haveALTER ANY USER permissions to the database.USE HomeLending;GO-- Creates Database Users Mapped to SQL Server LoginsCREATE USER SMITHJW FOR LOGIN SMITHJW;GOCREATE USER JONESBF FOR LOGIN JONESBF;GOCREATE USER JOHNSONTE FOR LOGIN JOHNSONTE;GOCREATE USER KELLEYWB FOR LOGIN KELLEYWB;GOCREATE USER REAGANCX FOR LOGIN REAGANCX;GOCREATE USER WOLFBA FOR LOGIN WOLFBA;GOListing 2-3: Creating the six database users, corresponding to our SQL Serverlogins.Assigning Members to RolesHaving created the roles, SQL Server logins and the database users for oursample database, we are now ready to assign membership of each databaserole. This is accomplished through the execution of the sp_addrolemembersystem stored procedure. The syntax of this system stored procedure is asfollows:sp_addrolemember [Role Name],[Member Name]This system stored procedure's arguments are:• Role Name: The textual reference to the database role in whichmembers are being added.• Member Name: The textual reference to the database user, databaserole, Windows login or Windows group that is being added to thedatabase role specified in the role name argument.45

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!