SQL Script to generate columns for triggers

  • Comments posted to this topic are about the item SQL Script to generate columns for triggers

  • SELECT CASE WHEN column_id = MIN(column_id) OVER(PARTITION BY 1) THEN 'INSERT INTO ' + OBJECT_NAME(object_id) + ' (' ELSE ' ' END + name + CASE WHEN column_id = MAX(column_id) OVER(PARTITION BY 1) THEN ')' ELSE ', ' END FROM sys.columns WHERE object_id = OBJECT_ID('TableName') ORDER BY column_id

  • Or, Just drag the Columns node from the object browser into the Query editor.

    Mark
    Just a cog in the wheel.

  • read many time still don't understand what are you talking about. Which is your resutls ? copy paste what???

  • Thanks for the script.

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

You must be logged in to reply to this topic. Login to reply