Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)

  • RE: Using TOP To Rank Columns In a Table

    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

  • RE: A simple T-SQL statement to create a list of lookup values

    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...

  • RE: A simple T-SQL statement to create a list of lookup values

    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...

Viewing 3 posts - 1 through 3 (of 3 total)