Thursday, June 21, 2012

SQL transactions

declare @foo int
begin transaction bar
   insert into baz (qux)
   values ('qux')
   set @foo = @@error
   if @foo <> 0
      begin
         rollback transaction bar
         return(1)
      end
commit transaction bar
return(0)

No comments:

Post a Comment