newB trigger question,

  • Thread starter Thread starter Blue Man
  • Start date Start date
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
 
Back
Top