post icon

SQL Transaction query

Ecco lo snippet per effettuare una query TSQL in transazione

BEGIN TRANSACTION
 
 -- do query in transaction
 print 'sono in transazione...'

IF @@Error <> 0 
 BEGIN
  ROLLBACK TRANSACTION 
 END
ELSE
 BEGIN
  COMMIT TRANSACTION 
 END

19 febbraio 2009 @ 19:00

No comments yet.

Leave a comment

Leave a Reply

Are you human? Time limit is exhausted. Please reload CAPTCHA.