1. 如果B的数据能清空,就清空直接用DTS导入咯 2. 如果B不能清空,可以建立个linked server,然后insert .... select ... from A.table where a.table.data not in B.table.data; 3. DTS导的时候可以用SQL 导入的,你可以试下
将tab1插入tab2:@p1是列,也就是判读有无重复值的: begin tran declare @p1 varchar(10)declare tmp cursor scroll for select 列1 from tab1 open tmp fetch first from tmp into @p1 while @@fetch_status=0 begin if exists(select * from tab2 where 列2=@p1) begin fetch next from tmp into @p1 end else begin insert 句子 fetch next from tmp into @p1 end end 大概就是这样。 不好意意思现在才回,不知道来得及不?
2. 如果B不能清空,可以建立个linked server,然后insert .... select ... from A.table where a.table.data not in B.table.data;
3. DTS导的时候可以用SQL 导入的,你可以试下
DTS没有用过,如果不能更改。楼上是个好主意!
begin tran
declare @p1 varchar(10)declare tmp cursor scroll for
select 列1 from tab1
open tmp
fetch first from tmp into @p1
while @@fetch_status=0
begin
if exists(select * from tab2 where 列2=@p1)
begin
fetch next from tmp into @p1
end
else
begin
insert 句子
fetch next from tmp into @p1
end
end
大概就是这样。
不好意意思现在才回,不知道来得及不?