Click here to Skip to main content
15,851,387 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all

I have this below query and i want to run this 3 times under a single transaction.
Please tell me how to do this
SQL
update transaction_details set transaction_details.status=3 
from transaction_details, commodity_codes  
where transaction_details.status=2 
  and transaction_details.item_code=commodity_codes.ahara_commodity_code 
  and bill_no='" + _with1["BillNo"] + "' 
  and transaction_details.trans_date ='" + _with1["Date"] + "'
Posted
Updated 10-Mar-15 22:32pm
v2
Comments
Faisalabadians 11-Mar-15 3:40am    
Black_Rose where is your transaction as I can't see any thing in above code snippet
Sinisa Hajnal 11-Mar-15 4:04am    
What's the problem? If you know how to run it once, you can run it any number of times with or without transaction open.
deepankarbhatnagar 11-Mar-15 4:40am    
Not getting your query? please explore it

1 solution

SQL
Begin tran t1
your query 1
your query 2
your query 3

 IF (@@ERROR <> 0) BEGIN
        PRINT 'Unexpected error occurred!'
        ROLLBACK TRAN
        RETURN 1
    END
else
BEGIN
commit tran t1
end
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900