与存储过程相关的问题 [英] Question Related to Stored Procedure

查看:81
本文介绍了与存储过程相关的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



我是存储过程的新手,我的问题是



如果我执行sql中的重复任务使用存储过程

并且如果存储过程正在执行时发生任何错误

是否有可能在错误之前执行的数据发生更改发生...



感谢提前。

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.

推荐答案

//@@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认为它会帮助你...但是让我知道它是否对你有所帮助,如果你喜欢这个答案也不要忘记喜欢


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


默认是的将更新以前的陈述。如果您想要关注全部或无,那么您需要在开始时启动事务。然后根据最终结果回滚或提交。
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.


是的,它将更新所有以前的语句
Yes it will update the all the previous statements


这篇关于与存储过程相关的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆