Assign Tablewsie rights to User in SQL Server

Dear All

Following thing can be done to give table wise rights to a specific user in a database
1) Create a user in security –> logins options of SQL server enterprise manager
2) Allow master database access to the user while creating
3) Then Open notepad and type following lines in it
4) EXEC SP_ADDUSER ‘ username’ ( user name is the user created in step 1)
5) GRANT SELECT ON ‘table name1’ TO username
6) GRANT SELECT ON ‘table name2’ TO username
7) Save the file with extension .SQL
8 ) Open SQL analyzer with Windows Authentication or SA login
9) Select the database name from list ( top in title bar )
10) Now in SQL Analyzer from File menu select Open and select the SQL file which is created in step 7
11) Press f5 to execute the Script
12) Its all done

With Regards,

Prashant Deshpande

Advertisements

Leave a comment

Filed under Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s