BigMickeyD
IS-IT--Management
I'm new to writing triggers and could use some help.
The table contains makeup requests, which have a requestID,
a status (R - requested, P-Processed) and a starting and
ending document number.
MR_RequestID MR_Status MR_StartDoc MR_EndDoc
12345 P 0000012345 0000024792
12346 R 0000127342 0000127353
12347 R 0000162837 0001234567
...
23456 R 0000162837 0000213670
The insert trigger should disallow adding a new record where the starting and ending numbers being inserted exist in any of the existing requests at Status 'R'. Otherwise it's OK to insert the record.
We thought about exploding the numbers and having a row for each document but that would produce a large table on the order of 10 million rows.
Any ideas or suggestions would be appreciated. Is a trigger the best approach?
Thanks
The table contains makeup requests, which have a requestID,
a status (R - requested, P-Processed) and a starting and
ending document number.
MR_RequestID MR_Status MR_StartDoc MR_EndDoc
12345 P 0000012345 0000024792
12346 R 0000127342 0000127353
12347 R 0000162837 0001234567
...
23456 R 0000162837 0000213670
The insert trigger should disallow adding a new record where the starting and ending numbers being inserted exist in any of the existing requests at Status 'R'. Otherwise it's OK to insert the record.
We thought about exploding the numbers and having a row for each document but that would produce a large table on the order of 10 million rows.
Any ideas or suggestions would be appreciated. Is a trigger the best approach?
Thanks