sql问题

declare @depotid char(50),@s_name char(50) ,@code char(50),@name char(50),@st_phone char(50) ,@icount int = 0

declare hysl_cursor cursor

for (

select b.st_phone, a.depotid,a.s_name,b.code,b.name from b_depot a 

left join b_employe b

on a.id = b.depot_id

where

a.states = '1'

and b.states = '1'

and a.depotid not in (select 店铺编号 from #hysl where 店铺编号 is not null)

--order by a.depotid

)

open hysl_cursor;

fetch next from hysl_cursor into @st_phone, @depotid,@s_name,@code,@name;

while @@FETCH_STATUS = 0 

begin

print @icount

--print @depotid

insert into #hysl(orderby,xuhao,st_phone,店铺编号,店铺名称,导购编号,导购姓名,线下会员数量) values(0,0,@st_phone,@depotid,@s_name,@code,@name,0);

fetch next from hysl_cursor into @st_phone, @depotid,@s_name,@code,@name;

set @icount = @icount + 1

end

close hysl_cursor;

DEALLOCATE hysl_cursor;

go

我用游标取出数据,有800多行,但是插入到表中就只插入200多行就停止插入了

用户y7163732 发布于 2020-12-22 14:13
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共1回答
最佳回答
1
evprinceLv2见习互助
发布于2020-12-22 16:01

表字段长度短了

  • 2关注人数
  • 401浏览人数
  • 最后回答于:2020-12-22 16:01
    请选择关闭问题的原因
    确定 取消
    返回顶部