Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 sp_grantlogin inside a trigger?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-08-16 : 09:37:07
Still_learning writes "Windows Server 2003
SQL 2000 SP4
We are trying to creat a trigger on a login table for an application. It would add an AD user onto the server whenever a record was added into the main table through the application. Right now we get the following error:

Server: Msg 15002, Level 16, State 1, Procedure sp_grantlogin, Line 24
The procedure 'sp_grantlogin' cannot be executed within a transaction.

Is it true that security activities cannot be performed inside a trigger or is it all system stored procs or is all stored procs?

Thanks for the help!"

KenW
Constraint Violating Yak Guru

391 Posts

Posted - 2006-08-16 : 14:13:57
According to Books OnLine

quote:

sp_grantlogin cannot be executed within a user-defined transaction.



Since this is stated specifically for sp_grantlogin, I'd suspefct it's not all stored procs.

By the way: Are you sure you're wanting to run sp_grantlogin and not sp_addlogin? Again, quoting from BOL:

quote:

Use sp_grantlogin to reverse the effects of a previous sp_denylogin that has been executed for a Windows NT user.



Since you said "add an AD user", I'd suspect you're using the wrong sp.

Ken
Go to Top of Page
   

- Advertisement -