![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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 |
#3
| |||
| |||
|
|
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 |
#4
| |||
| |||
|
|
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. |
#5
| |||
| |||
|
|
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 (AT) dpratte (DOT) com> wrote in message news:1115474335.494377.167790 (AT) o13g2000cwo (DOT) googlegroups.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 |
![]() |
| Thread Tools | |
| Display Modes | |
| |