ALTER FUNCTION [dbo].[fnGetVal]( @s varchar(8000), @label varchar(1000) ) RETURNS varchar(1000) AS BEGIN DECLARE @value varchar(1000) , @value_start int , @value_end int SET @value_start = charindex(@label,@s) IF @value_start > 0 BEGIN SET @value_start += len(@label) + 3 SET @value_end = charindex(',',@s,@value_start) IF @value_end > @value_start BEGIN SET @value = substring(@s,@value_start,@value_end-@value_start) END ELSE BEGIN SET @value = substring(@s,@value_start,len(@s)-@value_start+1) END END RETURN ltrim(rtrim(@value)) END
No comments:
Post a Comment