Professional Documents
Culture Documents
(D) Administration
CREATE USER user_name
[ { { FOR | FROM } { LOGIN login_name | WITHOUT LOGIN ]
[ WITH DEFAULT_SCHEMA =schema_name ]
• To create user with windows authentication
CREATE LOGIN student WITH PASSWORD = ‘S#123';
To create a SQL Server login that uses Windows Authentication (SQL Server Management Studio)
1. In SQL Server Management Studio, open Object Explorer and expand the folder of the server instance in which to
create the new login.
2. Right-click the Security folder, point to New, and then click Login.
3. On the General page, enter the name of a Windows user in the Login name box.
4. Select Windows Authentication.
5. Click OK.
• Contd.
• ALTER USER student WITH DEFAULT_SCHEMA=testdb;
• DROP USER student;
• GRANT EXECUTE ON testdb.del_rec TO student;
• DENY DELETE ON testdb.Inventory TO student;
(E) DEPLOYMENT - BACKUP AND RESTORE
• Your simplest backup strategy is to run, at regular intervals, the following SQL Server backup command, which will
perform a full backup of the database:
ALTER DATABASE AdventureWorks
SET RECOVERY SIMPLE;
BACKUP DATABASE AdventureWorks
TO DISK = 'C:\Backups\AdventureWorks.BAK‘;
• RESTORE VERIFYONLY
FROM DISK = 'C:\backups\Adventureworks.bak'