日期:2014-05-17 浏览次数:20546 次
select *
from Invoicing_Invoicing
where charindex(','+cast(id as varchar(10))+',',','+'712,713,714,715,716,717,718,719,720,721,722,723,724,725,726,727,728,774,1052,1053,1054,1055,1056,1057,1059,1061,1062,1065,1067,1068,1069,1070,1071,1087,1088,1089,1091,1092,1093,1095,1097,1098,1099,1100,1638,1640,1641,1642,1878,1879,1880,1881,1882,1883,1884,1885,1886'+',')>0
and userid=132
ALTER function [dbo].[Func_Contains]
(
@Source varchar(200),
@Temp varchar(200)
)
returns bit
begin
declare @i int
set @i=0
set @i=charindex(',',@Source)
if(@i<1)
begin
if (@Temp=@Source)
begin
return 1
end
end
else
begin
if(@Temp =substring(@Source,0,charindex(',',@Source)))
return 1
if(charindex(','+@Temp+',',@Source)>0)
return 1
while (charindex(','+@Temp,@Source)>0)
begin
if(@Temp=substring(@Source,0,charindex(',',@Source)))
return 1
set @Source=substring(@Source,charindex(',',@Source)+1,len(@Source))
end
if(@Temp=@Source)
return 1
end
return 0
end