如果一个查询比第二个查询更受激励,如何在存储过程中编写查询 [英] how to write query in store procedure if one query exicut than 2nd query exicute

查看:81
本文介绍了如果一个查询比第二个查询更受激励,如何在存储过程中编写查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当第一个查询执行且结果为true时,比我当时只想执行第二个查询

when 1st query execute and result is true than only i want to execute 2nd query at that time

推荐答案


检查此链接
如何在多个表中插入数据在一个存储过程中? [
Hi ,
Check this link
how can i insert data in multiple table in one store procedure?[^]
Best Regards
M.Mitwalli


执行第一条语句后,请检查错误,然后根据成功执行第二条语句.使用@@ error全局变量

@@ error
在每个Transact-SQL语句之后,服务器将此变量的值设置为整数值:


0如果语句成功

错误号如果语句失败
After executing the first statement please check for error then based on the success execute the second statement. Use @@error global variable

@@error
After each Transact-SQL statement, the server sets the value of this variable to an integer value:


0 If the statement was successful

Error number If the statement has failed


IF (QUERY1)
BEGIN
QUERY2
END



http://sqltutorials.blogspot.in/2007/06/sql-ifelse-statement.html [^ ]



http://sqltutorials.blogspot.in/2007/06/sql-ifelse-statement.html[^]


这篇关于如果一个查询比第二个查询更受激励,如何在存储过程中编写查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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