sql中对比两个字符串中缺少的字符

来源:互联网 发布:精通d3.js pdf 编辑:程序博客网 时间:2024/06/05 18:42

declare @s1 varchar(8000),@s2varchar(8000)

set @s1='1,2,3,5'

set@s2='1,2,3,4,5,6'

set@s1=' select id='+ replace(@s1,',',' union all select ')

set @s2=' select id='+ replace(@s2,',',' union all select ')

set @s1=' select b.* from ('+ @s1+ ') a right join ('+ @s2+ ') b on a.id=b.id where a.id is null'exec(@s1)

原创粉丝点击