如何给存储过程中插入查询的条件? [英] how to give where condition for insert query in stored procedure?

查看:105
本文介绍了如何给存储过程中插入查询的条件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




谁能知道..




Can anyone Know..

how to give where condition for insert query in stored procedure?

推荐答案

您不能.因为,您将没有此行,可以对其执行where子句.

使用更新语句.
You cann''t. Because, you will not have this row yet for which you can do a where clause on it.

Use Update statement.




使用此

表名称 Employee

ID名称年龄城市
1 Aditya 22 Kanpur
2 Bhushan 24 Lucknow
3 Chaturvedi 23德里

Hi,

Use This

Table Name Employee

ID Name Age City
1 Aditya 22 Kanpur
2 Bhushan 24 Lucknow
3 Chaturvedi 23 Delhi

CREATE PROCEDURE GetDetails
AS
BEGIN
      select Name,Age,City from Employee WHERE ID=1
END


您好.....

试试这个...

hi there.....

try this ...

CREATE PROCEDURE spInsertProcedure
AS
BEGIN
     INSERT INTO tableName SELECT Column1 FROM tableName2 WHERE (Condition)..
END




希望对您有帮助.




hope this help u.


这篇关于如何给存储过程中插入查询的条件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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