sqlserver 字符串分割函数
?
CREATE??? function Split as begin ? declare @beginIndex int,@separatorIndex int,@stringLength int ? select @beginIndex = 1 ? select @stringLength = len(@charString) ? while @beginIndex <= @stringLength ??? begin ????? select @separatorIndex = charIndex(@separator,@charString,@beginIndex)????????????? ????? declare @v_char nvarchar(4000) ????? if @separatorIndex = 0 ???????? select @separatorIndex = @stringLength + 1 ????? select @v_char = substring(@charString,@beginIndex,@separatorIndex-@beginIndex) ????? insert into @tb_temp values (@v_char) ????? select @beginIndex = @separatorIndex + 1 ??? end?????????????? ? return end (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |