DECLARE @Result VARCHAR(MAX)
SET @Result = ''
SELECT @Result = @Result +COLUMN_NAME + ','
FROM dbo.TABLE_NAME
IF(LEN(@Result) > 0 )
SELECT @Result = SUBSTRING(@Result,1,LEN(@Result)-1)
-- Return the result of the function
SELECT @Result as COLUMN_NAME
SET @Result = ''
SELECT @Result = @Result +COLUMN_NAME + ','
FROM dbo.TABLE_NAME
IF(LEN(@Result) > 0 )
SELECT @Result = SUBSTRING(@Result,1,LEN(@Result)-1)
-- Return the result of the function
SELECT @Result as COLUMN_NAME
No comments:
Post a Comment