-
SQL 2005 system table Q
When I create a login it populates the syslogins table. What table stores the information from an sp_grantdbaccess? I need verify a user has access rights to a specific database before running a process? -A
-
In sys.sysusers of each db.
-
THANK YOU !!! Now a follow-up question. Why do I receive an error when I uncomment the second EXEC--it works just fine as is however, I would like to run both SP's?
BEGIN
PRINT 'HELLO MOTO USER_ID: ' +@userID
IF EXISTS (select name from sysusers where name = @userID)
EXEC sp_addrolemember 'db_denydatareader', @userID
--EXEC sp_addrolemember 'db_denydatawriter', @userID
ELSE
PRINT 'N/A'
END
-
I am not positive, but I think by default your if statement can only run a single statement. To run multiple statements, you will have to wrap the if statements in a begin/end statements.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|