Академический Документы
Профессиональный Документы
Культура Документы
Example:
1.Create TestTable
USE TestData
GO
CREATE TABLE CSVTest
(ID INT,
FirstName VARCHAR(40),
LastName VARCHAR(40),
BirthDate SMALLDATETIME)
GO
2.Create CSV file in drive C: with name sweetest. text with the following conten
t. The location of the file is C:\csvtest.txt
1,James,Smith,19750101
2,Meggie,Smith,19790122
3,Robert,Smith,20071101
4,Alex,Smith,20040202
3.Now run following script to load all the data from CSV to database table. If t
here is any error in any row it will be not inserted but other rows will be inse
rted.
BULK
INSERT CSVTest
FROM 'c:\csvtest.txt'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
GO
7. Disk admin:[MDF,NDF,LDF]
Any login can manage the disk file when login given permissions of "DISK ADMIN"
Ex: Moving the files from one drive to another drive
8. Sysadmin:
Any login given sysadmin permissions nothing but ADMINISTRATOR at SQL Server Lev
el.Login can perform any activity with in a SQL Server without any limitations.
Note: Always sysadmin permissions should be with DBA's and never grant sysadmin
role to any other teams.
Note: If any other team need sysadmin then Ask justification and approval from h
is management.
Note: Upto SQL 2008 R2 WE HAVE FIXED SERVER ROLES BUt from SQL 2012 onwords we h
ave new feature called " Can create customized or user defined server roles"
9.Public:
This is the default rols given to any login .Main purpose login get basic connec
tivity permissions to instance. we can not remove this role to any login.
===========================================
LEVEL:2 DATABASE ROLES:
1. DB_DATAREADER: User can only perform data read from the tables and also can s
ee list of tables.
2.DB_DATAWRITER:User can only perform data write operations into tables.
3. DB_DENYDATAREADER: USER never able to perform data read operation
4. DB_DENYDATAWRiter: USER never able to perform data write operation
Note:
When login given sysadmin and deny permission ; SYSADMIN IS THE FIRST PREFERENCE
AND DENY PERMISSION NOT WORKS
WHEN LOGIN GIVEN dbowner and deny permission ; deny IS THE FIRST PREFERENCE AND
DBOWNER PERMISSION NOT WORKS.
5. DB_OWNER: User can all permissions at database level..i.e he is the owner of
the database.
6. BACKUP operator: User can only able to perform backup of the database and tri
gger check point operation.
7. DDL Admin: User can perform only CREATE TABLE, ALTER TABLE and Drop table ope
rations with in database.
8. Access admin:Can able to perform only USER CREATION and User account deletion
.
9. Security admin:
User can able to perform GRANT , WITH GRANT and Deny permissions.
With grant: can always same set of roles to other user accounts.
================================