newB trigger question,

B

Blue Man

hello
I have 2 table and I want to create a trigger and when ever I add a row in
parent table the row insert in child table with the same id.
creating tables :

create table parent (
table_id integer not null primary key,
dummycol integer )

create table child(
table_id integer not null,
dummycol2 integer ,
foreign key (table_id ) references parent(table_id)
ON DELETE CASCADE
ON UPDATE CASCADE
)

and the trigger Í tried but couldn't fix :

create trigger copyrow
on parent
after insert as
insert into child (table_id)
values (parent.table_id)


the error message says it accepts only variables and constants, then how can
i assign the value to the row?
thanks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top