Subject | Re: How do I test for a value before an INSERT? |
---|---|
Author | prokhorovav |
Post date | 2002-06-05T10:28:12Z |
--- In ib-support@y..., Derek Basch <dbasch@y...> wrote:
create view all_data_from_all_tables
(fields_from_table1,fields_from_tables2,...)
as
select t1.fields_from_table1,t2.fields_from_table2,...
from table1 t1
join table2 t2.on t2.table1_id=t1.id
...
and write before insert, before update and before delete triggers for
View all_data_from_all_tables
for example:
create trigger all_data_from_all_tables_bi
for all_data_from_all_tables
before insert
as
begin
insert into table1(fields_from_table1)
values(new.fields_from_table1);
insert into table2(fields_from_table2)
values(new.fields_from_table2);
end
Also you can add into triggers the addition funcionality you need.
Andrey Prokhorov
> Hi,You can create View like this:
> Im new to SQL and I have created several tables and
> would like to be able to INSERT to several of them at
> the same time. I cant seem to find any
> examples/techniques for breaking apart records and
> inserting into multiple tables.
>
create view all_data_from_all_tables
(fields_from_table1,fields_from_tables2,...)
as
select t1.fields_from_table1,t2.fields_from_table2,...
from table1 t1
join table2 t2.on t2.table1_id=t1.id
...
and write before insert, before update and before delete triggers for
View all_data_from_all_tables
for example:
create trigger all_data_from_all_tables_bi
for all_data_from_all_tables
before insert
as
begin
insert into table1(fields_from_table1)
values(new.fields_from_table1);
insert into table2(fields_from_table2)
values(new.fields_from_table2);
end
Also you can add into triggers the addition funcionality you need.
Andrey Prokhorov