Created
March 2, 2017 19:57
-
-
Save aramkoukia/60e06f1c68582857f474d3cb71fc90b2 to your computer and use it in GitHub Desktop.
TSQL COALESCE comma separate rows
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
| DECLARE @List VARCHAR(8000) | |
| SELECT @List = COALESCE(@List + ',', '') + CAST(Color AS VARCHAR) | |
| FROM NameColorTable | |
| SELECT @List |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment