覓語(http://www.sqler.com/483769#1)
貉殊 一危郁 '2, 7, 3, 5, 9, 1, 0 ' 螳 れ願 .
貉殊 0 ~ 9蟾讌 螳 れ伎 , 覓伎企, 0 ~ 9 螳 覈 蟆 .
蟆曙 旧 4螳 .
襭
create table #temp(val varchar(30))
insert #temp values('2, 7, 3, 5, 9, 1, 0 ')
select
min(a.val)
from (
select 0 val union all
select 1 val union all
select 2 val union all
select 3 val union all
select 4 val union all
select 5 val union all
select 6 val union all
select 7 val union all
select 8 val union all
select 9 val
) a
cross join #temp b
where charindex(convert(char(1), a.val), b.val) = 0
csv螳 row襦 シ豎讌 朱..
with dummy
as
(
select 0 num union all
select 1 num union all
select 2 num union all
select 3 num union all
select 4 num union all
select 5 num union all
select 6 num union all
select 7 num union all
select 8 num union all
select 9 num
), rd(num)
as
(
select 2 union all
select 7 union all
select 3 union all
select 5 union all
select 9 union all
select 1 union all
select 0
)
select min(a.num)
from dummy a
left join rd b
on a.num = b.num
where b.num is null