728x90
728x170
CREATE FUNCTION [dbo].[splitstring_to_table]
(
@string NVARCHAR(MAX),
@delimiter CHAR(1)
)
RETURNS @output TABLE(
data NVARCHAR(MAX)
)
BEGIN
DECLARE @start INT, @end INT
SELECT @start = 1, @end = CHARINDEX(@delimiter, @string)
WHILE @start < LEN(@string) + 1 BEGIN
IF @end = 0
SET @end = LEN(@string) + 1
INSERT INTO @output (data)
VALUES(SUBSTRING(@string, @start, @end - @start))
SET @start = @end + 1
SET @end = CHARINDEX(@delimiter, @string, @start)
END
RETURN
END
728x90
그리드형
'DB' 카테고리의 다른 글
[DB] Redis (0) | 2021.06.29 |
---|---|
[DB] In Memory DB Ranking (0) | 2021.06.23 |
[DB] sql server 2017 where is configuration manager (0) | 2021.04.07 |
[DB] SQL Server 사용자 로그인 허용하기 (0) | 2021.03.25 |
[DB] Error : Null value is eliminated by an aggregate or other SET operation. (0) | 2020.08.14 |