declare @commaStringList varchar(max) set @commaStringList = '' select @commaStringList = @commaStringList + ', ' + CAST(ColumnName as VARCHAR) from MyTable -- remove leading comment if len(@commaStringList) > 3 set @commaStringList = substring(@commaStringList, 3, len(@commaStringList) - 2) -- show the result select @commaStringList
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
General News Suggestion Question Bug Answer Joke Praise Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.