drop table #a
select cast(null as varchar(6000)) a into #a
insert #a
exec XP_CMDSHELL 'DIR D:/weekdev_06_25/weekdev/bin/UserData/新建文件夹/*旺旺统计.csv'
delete from #a where a not like '%WangWang%' or a is null
update #a set a=substring(a,37,120)
--select * From #a
declare @b varchar(4000),@tt int,@a varchar(2000),@sql varchar(2000)
set @tt=0
declare mycursor cursor for select a from #a
--为所获得的数据集指定游标
open mycursor --打开游标
fetch next from mycursor into @a --,@username,@userpwd --开始抓第一条数据
--select @a
while(@@fetch_status=0) --如果数据集里一直有数据
begin
--Set @sql = 'exec wfp..pr_读取淘宝CSV数据库 ''D:/'','''+@a+''','''+@b+''',''xufengfei'',''agt_trad.'',''拍拍'',''申通'''
Set @sql='exec wfp..pr_客户分析_客服聊天数据 ''centaur'',''AGT_TRAD.'','''+@a+''',''D:/weekdev_06_25/weekdev/bin/UserData/新建文件夹/'',''CAST(getdate()-10 as varchar(50))'',''CAST(getdate() as varchar(50))'''
set @tt=@tt+1
print(@tt)
exec(@sql)--需要执行
fetch next from mycursor into @a
end
close mycursor --关闭游标
deallocate mycursor --删除游标