----------------------------Hi all,

I have two data tables which both reference another table that contains 
comments in a note data-type column.

I also have views which use one or other of the data tables with the comments 
table.

As is the way with these things I have just spent an interesting afternoon 
ensuring that the comments table contains rows that link to both of the data 
tables so that the views work.

It seems that the simplest way to ensure that I don't break the views again is 
to create a couple of triggers on the data tables to put a default row in the 
comments table.

I _think_ that I understand the PUTting and alter table requirements, however, 
I have never used a trigger before and I'm not quite sure how to write the 
commands that I need for the stored procedure.

What I want to do is add an IdNum and a default value for the comment to the 
comments table every time a row is added to either of the data tables.

Is this anything like correct:

INSERT INTO tComments (IdNum, cComments) SELECT IdNum, 'No comments' +
FROM tData1 WHERE CURRENT OF SYS_NEW

where IdNum is the just inserted new value in the data table.
Or, do I have to set a variable to the value of IdNum and do it this way:

INSERT INTO tComments (IdNum, cComments) VALUES (vIdNum, 'No comments')
 

Thanks in advance for any insights, 

Regards, 

Alastair 

 

----------------------------

Alastair Burr

St. Albans, UK.

[EMAIL PROTECTED]

-----------------------------

 

Reply via email to