Re: Is this correct use of INSTEAD OF Triggers? Hi
I missed the title to this! Rather than use a trigger I would put the logic
into a stored procedure.
John
"John Bell" <jbellnewsposts@hotmail.com> wrote in message
news:427d0150$0$1878$da0feed9@news.zen.co.uk...
> Hi
>
> You can try something like:
>
> INSERT INTO Table C
> SELECT col1, col2, col3 FROM TABLE A
> WHERE <CLAUSE TO TEST CONSTRAINT FAIL>
>
> INSERT INTO Table B
> SELECT col1, col2, col3 FROM TABLE A
> WHERE <CLAUSE TO TEST CONSTRAINTS PASS>
>
> OR
> INSERT INTO Table B
> SELECT col1, col2, col3 FROM TABLE A
> WHERE NOT EXISTS ( SELECT * FROM TABLE C WHERE <CLAUSE TO CHECK NOT IN C>)
>
> John
>
> "Dan" <dpratte@dpratte.com> wrote in message
> news:1115474335.494377.167790@o13g2000cwo.googlegr oups.com...
>>I am loading data from table A into table B. Certain columns in B have
>> check constraints. I'd like for any rows from A, which violate
>> constraints, to be inserted into a third table, C. When the process is
>> finished, I'll have only good rows in B, and exeption rows in C.
>>
>> I am investigating INSTEAD OF triggers, however my question to the
>> group is, is there a better or best practice for this scenario? This
>> must be common. Any high-level tips or direction will be highly
>> appreciated.
>>
>> DAP
>>
>
> |