Click here to Skip to main content
15,884,986 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I am new to stored Procedure and my question is

if i perform repetative task in sql using stored procedure
and if any error occur while Stored Procedure is executing
is it possible that there will be change in data that has been executed before the error occur...

thanks in Advance.
Posted

SQL
//@@ERROR is system function return execution status on 0=success, so you can check like below

//code
IF @@ERROR <>0
 //do something
ELSE
  //do some code

i think it will help you..try and let me know wether it help you or not and also don't forgot to like if you like the answer
 
Share this answer
 
Comments
Salman622 7-Apr-14 5:30am    
Thanks
Suk@nta 7-Apr-14 6:03am    
if u like my ans plz accept the answer by clicking thumbs up
Suk@nta 7-Apr-14 7:26am    
Welcome. Please rate the solution 5 being the highest.
Yes by default it will update the previous statements. If you want to follow All or None then you need to start transaction in the beginning. Then rollback or commit based on final outcome.
 
Share this answer
 
Comments
Salman622 7-Apr-14 5:11am    
can you provide the basic syntax for catching error if occur during excution and performing rollback or commit
ArunRajendra 7-Apr-14 5:14am    
Check this simple sample. http://www.codeproject.com/Tips/283065/SQL-Server-Transactions-Usage-Template
Salman622 7-Apr-14 5:30am    
Thanks Arun
ArunRajendra 7-Apr-14 5:51am    
Welcome. Please rate the solution 5 being the highest.
Yes it will update the all the previous statements
 
Share this answer
 
 
Share this answer
 

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