Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

access control in sql server

Posted on 2002-06-21
1
Medium Priority
?
388 Views
Last Modified: 2012-06-27
I currently doing an assignment on mandatory access control, which can grant access permission to user based on tables,rows or column.

Izzit possible i implement the madatory access control in ms sql server? I suspect it is the "grant" command?
0
Comment
Question by:cialat
1 Comment
 
LVL 5

Accepted Solution

by:
spcmnspff earned 280 total points
ID: 7099147
Before you do a grant you have to make sure there is a login on the server for the user and that user is added to the currentdb.  In the current database issue these commands before the grant:

-- Check for the login
If Not Exists(Select * from Master.dbo.Syslogins Where name = 'LoginName')
sp_addlogin  @loginame =  'login'
     ,  @passwd =  'password'  
     ,  @defdb =  'defaultdatabase'  

-- Check for the database user
If Not Exists(Select * From Sysusers U Join Master.dbo.SysLogins L ON U.SID = L.SID WHERE L.Name = 'LoginName')
sp_adduser @loginame =  'login'

--Now use the grant command, in the current database:
Grant Select, Insert, Update, Delete ON Object to login
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question