2016-07-22 5 views

答えて

0

利用番号tableを望んで存在していないすべての数字を入れたくない

;With cte 
as 
(
select top 20 number 
from numbers 
order by number 
) 
Insert into yourtable 
select top 1* from cte c1 where not exists(select 1 from yourtable t2 where t1.number=t2.id) 
あなたはまた、結合を使用することができます

..

Insert into yourtable 
select top 1 number 
from 
numbers n 
join 
yourtable t 
on t.id<>n.number 
and n<=20 
+0

Thnak you答えは、私はそれをチェックし、私は戻ってきます – user6615498

関連する問題