清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
CREATE FUNCTION tmp_f_include ( @str_ids varchar(255), @id int ) RETURNS int AS BEGIN declare @p1 int declare @p2 int set @p1 = 1 set @p2 = charindex(',', @str_ids, @p1) while @p2 > 0 begin if ltrim(rtrim(SUBSTRING(@str_ids, @p1, @p2-@p1))) = CAST(@id as varchar(255)) return 1 set @p1 = @p2 + 1 set @p2 = charindex(',', @str_ids, @p1) end set @p2 = len(@str_ids) + 1 if ltrim(rtrim(SUBSTRING(@str_ids, @p1, @p2-@p1))) = CAST(@id as varchar(255)) return 1 return 0 END GO select dbo.tmp_f_include(',,,,51,2,3,4,,,',5) select dbo.tmp_f_include(',,,,5,2,3,4,,,',5)