Skip to content

Instantly share code, notes, and snippets.

@JasonKleban
Created January 26, 2017 20:02
Show Gist options
  • Save JasonKleban/96a3b4debc802a92edccf86505a64898 to your computer and use it in GitHub Desktop.
Save JasonKleban/96a3b4debc802a92edccf86505a64898 to your computer and use it in GitHub Desktop.
Pack tests
SELECT * FROM [dbo].[UnpackStrings]('|~0123|0|ABC||~0000|DEF|0', '|', '0', '~')
SELECT * FROM [dbo].[UnpackStrings]('0|', '|', '0', '~')
DECLARE @Test dbo.StringArray
PRINT '::' + [dbo].[PackStrings](@Test, '|', '0', '~') + '::'
INSERT INTO @Test (Element)
VALUES
('')
,('0123')
,(NULL)
,('ABC')
,('')
,('0000')
,('DEF')
PRINT '::' + [dbo].[PackStrings](@Test, '|', '0', '~') + '::'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment