insert into 表1 select * from 表2

利用游标

delete saler
DECLARE @SalerID int
DECLARE @SalerName nvarchar(200)

DECLARE cursor1 cursor for
select
 [SalerID],
 [SalerName]
from [zmr817].[dbo].[Saler]

open cursor1
fetch next from cursor1 into
@SalerID,
@SalerName

while @@fetch_status=0
begin
insert into [newjcjq].[dbo].[Saler](
[SalerID],
[SalerName]
)
values(
@SalerID,
@SalerName)


fetch next from cursor1 into
@SalerID,
@SalerName

end

close cursor1                  
deallocate cursor1

 

转载于:https://www.cnblogs.com/yansheng/archive/2009/12/31/1636927.html

Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐