Re: Trigger to enforce uniqueness across databases
Posted in 2004
Spooky, I was doing this today - works fine, just run some SPL and raise an exception as required Neil Truby wrote: > > Is it possible to create an insert or update trigger that checks the value > of a particular field to be stored, looks up in a table on another database > to check that that value does not exist there, and returns an error and > prevents the update/insert if it does? > > For example: in database1 we are checking the value of product_no to be > inserted into the product table (product_no is a unique key). But we also > now need ot check that the value of product_id would not already be in > database2 either, so our trigger must check for the existance of product_no > in the product table on database2 and, if it exists, prevent the > update/insert and barf. > > thanks > Neil -- Paul Watson # Oninit Ltd # Growing old is mandatory Tel: +44 1436 672201 # Growing up is optional Fax: +44 1436 678693 # Mob: +44 7818 003457 # www.oninit.com #