OiO.lk Blog SQL Send message to trigger
SQL

Send message to trigger


Is it possible to send a message that can be used in trigger code?

Something like

CREATE TRIGGER MyTrigger ON MyTable
AFTER INSERT
AS BEGIN
  INSERT INTO AnotherTable (Col, TheMessage)
  SELECT Col, TRIGGER_MESSAGE FROM inserted -- TRIGGER_MESSAGE contains 'Hey, its me'
END

INSERT INTO MyTable (Col) VALUES (1) TRIGGER_MESSAGE 'Hey, its me'



You need to sign in to view this answers

Exit mobile version