对于存储过程中的每个循环 [英] for each loop in stored procedure
本文介绍了对于存储过程中的每个循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Select distinct(WareHouseCode) as Key1,PartNum as Key2,Company
from PartTran
where company =@companyname
它将获得20行
i需要将这些20个插入到一个新表中
it ll get 20 rows
i need to insert these 20rows in to one new table
Insert into newtable(Key1,Key2,Company)
values (
(Select distinct(WareHouseCode) as Key1,PartNum as Key2,Company from PartTran where company =@companyname )
查询已执行但是数据未插入,
如何做到这一点,
请帮助我......
我的邮件ID是:[邮件已删除]
query is executed but data not inserted,
How to do that,
Please help me...
my mail id is: [mail has been removed]
推荐答案
使用这样的查询...
use Query like this...
Insert into newtable(Key1,Key2,Company)
Select distinct(WareHouseCode) as Key1,PartNum as Key2,Company from PartTran where company =@companyname
快乐编码!
:)
Happy Coding!
:)
它不会那样工作。我们可以帮助您在CP论坛上发布解决方案,而不是邮寄它。
这是一个解决方案:
It doesn''t work like that. We can help you posting solution on CP forum, not mailing it.
Here is a solution:
Insert into newtable(Key1,Key2,Company)
Select distinct(WareHouseCode) as Key1,PartNum as Key2,Company
from PartTran
where company =@companyname
这篇关于对于存储过程中的每个循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文