Last active
September 28, 2015 16:39
-
-
Save dcs619/f010eb841fb3122d86c1 to your computer and use it in GitHub Desktop.
delimited Parse
This file contains hidden or 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
| -- Get a list of Member Id's and their schedules | |
| SELECT EntityId, r.value('.', 'varchar(255)') AS Schedule | |
| FROM ( | |
| -- create valid xml path | |
| SELECT EntityId, CAST('<n>' + REPLACE(Value, ',', '</n><n>') + '</n>' AS XML) AS 'Schedules' | |
| FROM AttributeValue | |
| WHERE Id = 1257002 | |
| ) AS baseXML | |
| -- parse the xml into a table | |
| CROSS APPLY Schedules.nodes('n') AS parse(r) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
translates this:
"5732FFF2-D1B0-4B6A-9303-5C3117C2EEA2,A3FF47F0-BCFF-4BA8-872A-273C5CEAF892,62BA8A23-CED4-41B6-8DF3-7CAFE5A85591,E3B80EB4-55F9-4E04-98F2-F1D5FB3462DF"
into this:
5732FFF2-D1B0-4B6A-9303-5C3117C2EEA2
A3FF47F0-BCFF-4BA8-872A-273C5CEAF892
62BA8A23-CED4-41B6-8DF3-7CAFE5A85591
E3B80EB4-55F9-4E04-98F2-F1D5FB3462DF