Re: [SQL] Advice for generalizing trigger functions

2007-12-28 Thread Marcin Stępnicki
Dnia 25-12-2007, Wt o godzinie 16:20 -0800, Richard Broersma Jr pisze: > I've created quite a few functions that log modifications to various history > tables. > (the history table has the same name as the base table but is prefixed by the > 'History.' schema.) > The only difference between fu

Re: [SQL] Advice for generalizing trigger functions

2007-12-27 Thread Erik Jones
On Dec 27, 2007, at 12:03 PM, Richard Broersma Jr wrote: --- On Thu, 12/27/07, Erik Jones <[EMAIL PROTECTED]> wrote: TG_TABLE_NAME will have the name of the table the trigger was fired on. With that and using EXECUTE for your INSERT statements, you'll probably be set. True the table name

Re: [SQL] Advice for generalizing trigger functions

2007-12-27 Thread Richard Broersma Jr
--- On Thu, 12/27/07, Erik Jones <[EMAIL PROTECTED]> wrote: > TG_TABLE_NAME will have the name of the table the trigger > was fired on. With that and using EXECUTE for your INSERT > statements, you'll probably be set. True the table name is the easy part, but how do I determine the Primary Key

Re: [SQL] Advice for generalizing trigger functions

2007-12-27 Thread Erik Jones
On Dec 25, 2007, at 6:20 PM, Richard Broersma Jr wrote: I've created quite a few functions that log modifications to various history tables. (the history table has the same name as the base table but is prefixed by the 'History.' schema.) The only difference between functions I can find is

Re: [SQL] Advice for generalizing trigger functions

2007-12-26 Thread Richard Broersma Jr
--- On Wed, 12/26/07, chester c young <[EMAIL PROTECTED]> wrote: > what I do for change log is to have one change log table with table_id > and column_id attributes that refer by to my internal meta_table and > meta_column tables. this always works and is in the end, I have found, > a bit more fl

Re: [SQL] Advice for generalizing trigger functions

2007-12-26 Thread chester c young
--- Richard Broersma Jr <[EMAIL PROTECTED]> wrote: > I've created quite a few functions that log modifications to various > history tables. (the history table has the same name as the base > table but is prefixed by the 'History.' schema.) The only difference > between functions I can find is the

[SQL] Advice for generalizing trigger functions

2007-12-25 Thread Richard Broersma Jr
I've created quite a few functions that log modifications to various history tables. (the history table has the same name as the base table but is prefixed by the 'History.' schema.) The only difference between functions I can find is the table name. Is there any way to generalize these myriad