sql query to get comma separated values code example
Example 1: sql server: select column values as comma separated string
DECLARE @SQL AS VARCHAR(8000)
SELECT @SQL = ISNULL(@SQL+',','') + ColumnName FROM TableName
SELECT @SQL
Example 2: search from comma separated values in sql server
WHERE tablename REGEXP "(^|,)@search(,|$)"