SQL Server 2005 Insert Trigger or Instead of Insert Trigger
Posted on 2009-04-06
I have a table, Email, that holds email addresses, and another table, emailmessage, that holds email messages. The tables do not have any relationship keys.
For any new record inserted into emailmessage, first check if the values being inserted into fields "toemailaddress" OR "fromemailaddress" exist in table Email. If yes, then do the insert. If no, then don't.
I would like to use an Instead of Insert trigger and only commit if the condition is met. Or, if not possible, do the check after insert and delete the row if the condition is not met.