34,575
社区成员
发帖
与我相关
我的任务
分享
use HC
create table #tb (vNo varchar(15))
insert into #tb
select '2006206110'
union all
select '2006216700'
union all
select '2006236570'
union all
select '2006237470'
union all
select '2006007030'
union all
select '2006069140'
declare @sql varchar(200)
set @sql='2006007030,2006069140,20061010888'
select @sql=replace(','+@sql+',',','+vno+',','') from #tb
select replace(@sql,',','') vNo
drop table #tb
/*
20061010888
*/
create table #tb (vNo varchar(15))
insert into #tb
select '2006206110'
union all
select '2006216700'
union all
select '2006236570'
union all
select '2006237470'
union all
select '2006007030'
union all
select '2006069140'
declare @sql varchar(200)
set @sql='2006007030,2006069140,20061010888'
select @sql=replace(','+@sql+',',','+vno+',','') from #tb
select replace(@sql,',','')
create table #tb (vNo varchar(15))
insert into #tb
select '2006206110'
union all
select '2006216700'
union all
select '2006236570'
union all
select '2006237470'
union all
select '2006007030'
union all
select '2006069140'
Create table #tab (a varchar(20))
insert into #tab
select '2006007030' union
select '2006069140' union
select '20061010888'
select * from #tab where a not in (select vNo from #tb )
create table #tb (vNo varchar(15))
insert into #tb
select '2006206110'
union all
select '2006216700'
union all
select '2006236570'
union all
select '2006237470'
union all
select '2006007030'
union all
select '2006069140'
select * from (
select '2006007030' as vno union select '2006069140' union select '20061010888' )a
where vno not in (select vno from #tb )
drop table #tb
create table #tb (vNo varchar(15))
insert into #tb
select '2006206110'
union all
select '2006216700'
union all
select '2006236570'
union all
select '2006237470'
union all
select '2006007030'
union all
select '2006069140'
go
select * from
(
select '2006007030' tblColumn
union all
select '2006069140'
union all
select '20061010888'
) as tbl
where not exists(select * from #tb where vNo = tblColumn)