How to link table field with another
Posted in 2003
Topics: Triggers, Constraints & Referential Integrity
Hi, We have an application which has a column which we get from another database table when adding. Now users want this to be same as the other database table always. They are not ready to let us add a trigger on update of the other database table as it is another application. Is there any way this can be done without changing the design of my application?? Can i somehow link my column to this external table column?? Rgds Preetinder
Use a synonym: create synonym <synonym_name> for <infmxserver>:<database>.<tablename> Terrence Mullins Sr Database Administrator WagerWorks.com -----Original Message----- From: Preetinder .... [mailto:preetinder.dhaliwal@dhl.com] Sent: Monday, June 09, 2003 10:20 PM To: ids@iiug.org Subject: How to link table field with another [1308] Hi, We have an application which has a column which we get from another database table when adding. Now users want this to be same as the other database table always. They are not ready to let us add a trigger on update of the other database table as it is another application. Is there any way this can be done without changing the design of my application?? Can i somehow link my column to this external table column?? Rgds Preetinder
The customer is always right, but you are always within your rights to decide that the customer being right makes it impossible for you to help them and you can leave them to sink or swim. Well, sometimes you can. Maybe. Basically, they want you to achieve what's hard to do in the first place, and they want you to do it without changing either the database or the applications? Can't be done. Either the application has to enforce the constraint, or the database must. If the database must, then either some foreign key constraints or a trigger is going to be necessary; in fact, multiple triggers are likely to be necessary. If the trigger is not allowed either, then they have pasted you into a corner -- there's nothing to be done but get better educated customers. Of course, you could try educating these ones; but it sounds as if you've tried and not yet been successful. And if multiple databases are involved, as opposed to multiple tables in a single database, foreign key constraints are going to be necessary. The problem is at best incompletely specified; it is not clear whether the value in your table has to just match some row in the other table, or whether it needs to match the value in some very specific row in the other table. An FK constraint may not be the answer - even in a single database - and then a trigger is going to be necessary. What happens when the other app updates the value? Deletes the value? Ick! -- Jonathan Leffler (jleffler@us.ibm.com) STSM, Informix Database Engineering, IBM Data Management 4100 Bohannon Drive, Menlo Park, CA 94025 Tel: +1 650-926-6921 Tie-Line: 630-6921 "I don't suffer from insanity; I enjoy every minute of it!" |---------+-----------------------------> | | "Preetinder ...." | | | <preetinder.dhaliw| | | al@dhl.com> | | | Sent by: | | | forum.subscriber@i| | | iug.org | | | | | | | | | 06/09/2003 10:19 | | | PM | | | | |---------+-----------------------------> >------------------------------------------------------------------------------- --------------------------------------------------------------| | | | To: ids@iiug.org | | cc: | | Subject: How to link table field with another [1308] | | | >------------------------------------------------------------------------------- --------------------------------------------------------------| Hi, We have an application which has a column which we get from another database table when adding. Now users want this to be same as the other database table always. They are not ready to let us add a trigger on update of the other database table as it is another application. Is there any way this can be done without changing the design of my application?? Can i somehow link my column to this external table column?? Rgds Preetinder