简单问题 不知道哪里出错了 解决后散分
------ 执行以下存储过程后 只能将最后一行数据 插入HT_SALE_REC_COMPANY表 我想要逐行插入 改怎么做?
set @i =1
select @count =count(*) from Sheet1$
while(@i<=@count)
begin
delete from HT_SALE_REC_COMPANY
delete from ht_sale_comp_agree
select @rec_no=rtrim(ltrim(rec_no)),@com_name=rtrim(ltrim(comp_name))
from Sheet1$
where id=@i
insert into HT_SALE_REC_COMPANY(rec_no,com_name)
values(@rec_no,@com_name)
-----这里没有逐行插入数据
set @i =@i+1
end
[解决办法]
将
delete from HT_SALE_REC_COMPANY
delete from ht_sale_comp_agree
写到循环外
[解决办法]
你在while循环里用了这个 delete from HT_SALE_REC_COMPANY
当然之前的数据都被DELETE掉了,把那2句DELETE放到WHILE循环前就OK了
[解决办法]
是不是
delete from HT_SALE_REC_COMPANY
delete from ht_sale_comp_agree
有问题啊``