returning values inside transactions

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I have the following stored procedure. How would I return 1 for successful
transaction and 0 for failure?

-- Delete a headline in the current module.

create procedure dbo.Headlines_Delete

@ModuleID int,

@ItemID int

as

try

begin transaction

delete from Headlines

where ModuleID = @ModuleID

and ItemID = @ItemID

commit transaction

end try

begin catch

if @@trancount > 0

begin

rollback transaction

end

end catch




.



Relevant Pages

  • Re: transaction with unknown nbr of commands
    ... then call your wrapper stored procedure, passing it all of the user ... explicit transaction with a BEGIN TRAN statement, ... >When I run a sqlcommand in a transaction, ...
    (microsoft.public.dotnet.framework.adonet)
  • RE: Database updating issue
    ... I started a transaction on the connection class, passed this to the dataadapter, invoked the Update method on the dataadapter and finally commit the transaction. ... try threading the these calls to the stored procedure. ... To accomplish this task, the inserting of all rows, at the moment, I'm using ...
    (microsoft.public.dotnet.framework)
  • Re: SQLServerException: The server failed to resume the transactio
    ... Are you doing transaction management in your stored procedure? ... Can you post your stored procedure defintion, ... If I remove the transaction management code from the proc then everything ... I'm preparing a CallableStatement at the start of the loop and I'm reusing ...
    (microsoft.public.sqlserver.jdbcdriver)
  • Re: Error Handling.
    ... BEGIN TRANSACTION statement inside of a stored procedure, ... server is less efficient and more prone to problems. ... Error handling in your sprocs is necessary for performance, ...
    (microsoft.public.sqlserver.clients)
  • capturing and returning system errors to client application
    ... I am trying to catch an SqlException in an asp.net 3.5 client. ... A stored proc to insert a headline called Headlines_Insert. ... commit transaction ... 'This is being ignored like there is no exceptions for some reason. ...
    (microsoft.public.sqlserver.programming)