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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2 – Data Classification and RolesUSE HomeLending;GO-- Creates SQL Server LoginsCREATE LOGIN SMITHJW WITH PASSWORD = 'as98(*&sssr73x';GOCREATE LOGIN JONESBF WITH PASSWORD = 'ghls39**#kjlds';GOCREATE LOGIN JOHNSONTE WITH PASSWORD = 'asdpj3$dkEUmwm';GOCREATE LOGIN KELLEYWB WITH PASSWORD = 'lkjd&^aslkjdlJD';GOCREATE LOGIN REAGANCX WITH PASSWORD = 'HJ777jsb6$@jkjk';GOCREATE LOGIN WOLFBA WITH PASSWORD = 'hey4452h#552Vv';GOListing 2-2: Creating six SQL Server logins.Having created the SQL Server logins, we can create the correspondingdatabase users using the CREATE USER method. The following is an exampleof the syntax of this method:CREATE USER [User Name] FOR LOGIN [Login]This method's arguments are:• User name: This is the textual reference to the database user name.This is used to identify the database user when it is in use.• Login: This is the textual reference to the login that is to be associatedwith the user name. If the login is not provided it will map to a loginthat has the same name as the user account. If a login does not exist anerror will be returned.Additional arguments are available to associate the database user to acertificate or asymmetric key, which will be covered in later chapters. Also, adefault schema can be assigned to the database user. The default schemadefines the schema within the database that will be searched first for resolvingdatabase object names. If the default schema argument is not included, as willbe the case in our example, the default "dbo" schema will be used.44

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

Saved successfully!

Ooh no, something went wrong!