[color=darkred]declare @name varchar(20),@sid varchar(30)
declare cur cursor
for select 姓名,F11 from Sheet1$
open cur
fetch next from cur into @name,@sid
while @@fetch_status = 0
begin
if @sid is not null
begin
print 'update [192.168.123.201].htbz.dbo.t_Worker set wk_sid = '+@sid+' where wk_name = '+@name+''
update [192.168.123.201].htbz.dbo.t_Worker set is_ywbx = 1 where wk_name = @name
end
fetch next from cur into @name,@sid
end
close cur
DEALLOCATE cur [/color]
declare cur cursor
for select 姓名,F11 from Sheet1$
open cur
fetch next from cur into @name,@sid
while @@fetch_status = 0
begin
if @sid is not null
begin
print 'update [192.168.123.201].htbz.dbo.t_Worker set wk_sid = '+@sid+' where wk_name = '+@name+''
update [192.168.123.201].htbz.dbo.t_Worker set is_ywbx = 1 where wk_name = @name
end
fetch next from cur into @name,@sid
end
close cur
DEALLOCATE cur [/color]