Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

Table1 Autocounter used for PK - Insert Trigger: on AddNew Record copy new PK and add new record on Table2

$
0
0

Table1 - Autocounter the Autocounter is the PK

Table2 - no autocounter. Holds Metadata for Rules Engine

Insert Trigger: After Table1 completes a NewRecord - copy the autocounter (pk) and insert new record on Table2, updating the first field with the same autocounter number.


Rx

There is no Delete row on Table1. A Status changes from Active to Inactive so historical information is available. Only a New Record can be created. The first column is an autocounter - the first column from the autocounter is the PK.
It is this PK that must be copied with the insert after trigger into the Table2

Users can update Table1 - but can not change the autocounter PK

Table2 has metadata - It is unlikely that any fields on table2 will be updated if anything changes on Table1. This is a compliance regulatory DB. There are more rules than there is data. 



Viewing all articles
Browse latest Browse all 8428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>