declare @m table(Q varchar(20)) insert @m select '12A54' union all select 'B89' union all select '89C46' declare @n table(T varchar(10)) insert @n select 'A' union all select 'B' union all select 'C' union all select 'D'select * from @n a where not exists(select 1 from @m b where charindex(a.T,b.Q) > 0)/*结果 D */
create table m(q varchar(20)) insert into m(q) select '12A54' union all select 'B89' union all select '89C46' create table n(t varchar(20)) insert into n(t) select 'A' union all select 'B' union all select 'C' union all select 'D'declare @str varchar(8000) select @str = isnull(@str,'')+q from mselect * from n where charindex(n.t,@str)<=0drop table m drop table n
insert @m
select '12A54' union all
select 'B89' union all
select '89C46'
declare @n table(T varchar(10))
insert @n
select 'A' union all
select 'B' union all
select 'C' union all
select 'D'select * from @n a
where not exists(select 1 from @m b where charindex(a.T,b.Q) > 0)/*结果
D
*/
create table m(q varchar(20))
insert into m(q)
select '12A54'
union all select 'B89'
union all select '89C46'
create table n(t varchar(20))
insert into n(t)
select 'A'
union all select 'B'
union all select 'C'
union all select 'D'declare @str varchar(8000)
select @str = isnull(@str,'')+q from mselect * from n
where charindex(n.t,@str)<=0drop table m
drop table n