Re: add users in a transaction SQL Server 2000



You will have to use your own logic to make it RollbackAble:


"sp_grantlogin cannot be executed within a user-defined transaction."
http://msdn2.microsoft.com/en-us/library/ms173449.aspx


Jens K. Suessmeyer.

---
http://www.sqlserver2005.de
---


"maddog" <maddog@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:2B94A051-19CC-41F1-96B6-AB51D1E5C3B3@xxxxxxxxxxxxxxxx
I need to be able to add users to roles in serveral databases and if one of
the inserts fails I need to be able to roll back the whole transaction. I am
getting the following error:

The procedure 'sp_grantlogin' cannot be executed within a transaction.
The procedure 'sp_defaultdb' cannot be executed within a transaction.
The procedure 'sp_grantdbaccess' cannot be executed within a transaction.
The procedure 'sp_addrolemember' cannot be executed within a transaction.

.



Relevant Pages

  • Transactions failing in Loop
    ... I want to iterate through and if one fails ... 'Transaction init ... CountCustomers = CountCustomers + 1 ... This fails on the rstInvoice.Addnew for the second iteration through the loop. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Problems with deleting views
    ... if it fails, rollback the transaction and exit ... if it succeeds execute second statement ...
    (microsoft.public.inetserver.asp.db)
  • Re: Sql Transaction
    ... I do not think it is related to transaction. ... Check if user has proper permissions ... > I use System.Data.SqlClient.SqlTransaction type to execute several sprocs ... > fails if I use less priveleged account. ...
    (microsoft.public.dotnet.framework.adonet)
  • SqlTransaction.ZombieCheck error
    ... Server 2005 database. ... To try to track down the cause I put trace statements at every transaction ... I then ran the app again using the exact same input data and it succeeds. ... If I turn the logging off it fails again. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Try Catch...need my brain rattled.
    ... What if C fails? ... If the effects are changes to a database (or multiple databases that support ... way to rollback changes done so far if a later operation fails. ... operations into a containing transaction. ...
    (microsoft.public.dotnet.framework.aspnet)