从一个数据库导入另一个数据库

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

 

你可能感兴趣的:(数据库)