Home Forums SQL Server 2005 T-SQL (SS2K5) Trigger that uses a Parameter with Inserted/Deleted RE: Trigger that uses a Parameter with Inserted/Deleted

  • There's only one thing I find scarier than a cursor, and that's a cursor that is used inside of a trigger.

    Trust me, you do NOT want to go down this route. I know this isn't what you want to hear and I know why you don't want to hardcode field names in your trigger, but your reasons for not wanting to do so are in direct conflict with the performance of your database.

    You could create a "trigger creation script", into which you pass a table name as a parameter and it constructs a standard trigger template for that table and its columns.

    Then all you have to do is run that script for all of the tables you want triggers on.