Created
May 26, 2014 00:43
-
-
Save marsen/a6dbdc934b59b12a934d to your computer and use it in GitHub Desktop.
SQL Slipt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION [dbo].[UF_SliptToTable] | |
( | |
@psCSString VARCHAR(8000) | |
) | |
RETURNS @otTemp TABLE(sID VARCHAR(100)) | |
AS | |
BEGIN | |
DECLARE @sTemp VARCHAR(100) | |
WHILE LEN(@psCSString) > 0 | |
BEGIN | |
SET @sTemp = LEFT(@psCSString, ISNULL(NULLIF(CHARINDEX(',', @psCSString) - 1, -1), | |
LEN(@psCSString))) | |
SET @psCSString = SUBSTRING(@psCSString,ISNULL(NULLIF(CHARINDEX(',', @psCSString), 0), | |
LEN(@psCSString)) + 1, LEN(@psCSString)) | |
INSERT INTO @otTemp VALUES (@sTemp) | |
END | |
RETURN | |
END | |
GO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment