/**//**功能:不按先后顺序比较字符串序列是否相同**适用:SQLServer2000/SQLServer2005**返回:1相同0不相同**作者:Flystone**描述:学习Limpire(昨夜小楼)的方法后做一个动态SQL的**/CREATEprocsp_CompareString@Str1varchar(100),@Str2varchar(100),@Splitvarchar(10),@retintoutputASBEGINdeclare@Lenint,@Subvarchar(100)if@Str1=@Str2return(1)iflen(@Str1)<>len(@Str2)orlen(replace(@Str1,@Split,''))<>len(replace(@Str2,@Split,''))beginset@ret=0returnendset@str1='select'''+replace(@str1,@Split,'''ascolunionallselect''')+''''set@str2='select'''+replace(@str2,@Split,'''ascolunionallselect''')+''''declare@snvarchar(4000)set@s='ifexists(select1from('+@str1+')awherenotexists(select1from('+@str2+')bwherea.col=b.col)orexists(select1from('+@str2+')awherenotexists(select1from('+@str1+')bwherea.col=b.col)))select@ret=0elseselect@ret=1'execsp_executesql@s,N'@retintoutput',@retoutputENDGOdeclare@retintexecsp_CompareString'a,b,c','b,c,a',',',@retoutselect@retexecsp_CompareString'a,b,c','b,c,c,a',',',@retoutselect@retdropprocsp_CompareString/**//*-----------1(所影响的行数为1行)-----------0(所影响的行数为1行)*/