SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER FUNCTION [dbo].[f_IsContain](
@varstr varchar(500), --包含多个数据项的字符串
@searchvar varchar(40),
@split varchar(10) --数据分隔符
)
RETURNS int
AS
BEGIN
IF @varstr IS NULL RETURN ‘‘
DECLARE @strindex int
declare @strvalue varchar(40)
declare @result varchar(200)
set @result=‘‘
WHILE CHARINDEX(@split,@varstr)>0
begin
set @strindex=CHARINDEX(@split,@varstr)
set @strvalue=SUBSTRING(@varstr,0,@strindex)
if(@[email protected]) return 1
set @split=SUBSTRING(@split,@strindex+1,LEN(@varstr)[email protected])
end
if(@[email protected]) return 1
return 0
END
时间: 2024-10-13 10:23:50