Viewing 3 posts - 1 through 3 (of 3 total)
For select dthe columns without remove last comma
SELECT TOP 10 @columnName = COALESCE(@columnName + ',' + QUOTENAME(COLUMN_NAME), QUOTENAME(COLUMN_NAME))
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = @tableName
AND TABLE_SCHEMA = 'DBO'
ORDER BY ORDINAL_POSITION ASC
October 25, 2011 at 4:14 am
Hi David,
You don't have loose nothing.
There is only a redundant test in the second line of the article.
The first line of code is:
SET @MyStatusList = '' so @MyStatusList is...
March 22, 2011 at 3:53 am
In the sample of the article with the init of @MyStatusList='' the test ISNULL(@MyStatusList,'') is not necessary:
SET @MyStatusList = ''
SELECT @MyStatusList = ISNULL(@MyStatusList,'') + StatusDesc + ',' FROM MyStatus
Best...
March 22, 2011 at 2:56 am
Viewing 3 posts - 1 through 3 (of 3 total)