标签:字符 dex from rom 字符串分割 turn tab har entity
CREATE FUNCTION dbo.f_splitstr(
@str varchar(8000)
)RETURNS @r TABLE(id int IDENTITY(1, 1), value varchar(5000))
AS
BEGIN
/* Function body */
DECLARE @pos int
SET @pos = CHARINDEX(‘,‘, @str)
WHILE @pos > 0
BEGIN
INSERT @r(value) VALUES(LEFT(@str, @pos - 1))
SELECT
@str = STUFF(@str, 1, @pos, ‘‘),
@pos = CHARINDEX(‘,‘, @str)
END
IF @str > ‘‘
INSERT @r(value) VALUES(@str)
RETURN
END
select * from f_splitstr(‘中,国,人‘)
标签:字符 dex from rom 字符串分割 turn tab har entity
原文地址:https://www.cnblogs.com/itclw/p/11996782.html