Solved

access control in sql server

Posted on 2002-06-21
1
324 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 70 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now