0

I'm trying to create a trigger in MS SQL that overrides the update query ("instead of update"). I'd like to pass in an additional parameter to the trigger function, but so far, the only way I can do this is via the where clause or as part of the values I set. Is there another way of achieving this?

I've seen similar things where functions are used to mimic a table which allows parameters to be passed to a select query (e.g. 'select * from table(42)'). It would be great if I could do a similar thing with the update query...

Cheers, Max

Max
  • 101
  • 8

1 Answers1

0

Never ocurred to me that triggers could accept parameters. And after some minutes of search seems that is not possible but you can find some workarounds by using other tables of your schema or using SET CONTEXT_INFO instruction.

Here are some usefull links:

how-to-create-triggers-which-accepts-external-parameters-in-sql-server

pass-a-variable-into-a-trigger

Community
  • 1
  • 1
Yaroslav
  • 6,476
  • 10
  • 48
  • 89