Thread: Insert on create table
Can anyone tell what I am in need of to do smthng like: When: CREATE TABLE table_1 (...); Automaticaly to execute: INSERT INTO TABLE newtables (name) VALUE (table_1); 10x
--- Yovko Ilchev Yovkov <yyovkov@vipsolutions.net> wrote: > Can anyone tell what I am in need of to do smthng > like: > When: CREATE TABLE table_1 (...); > Automaticaly to execute: INSERT INTO TABLE newtables > (name) VALUE (table_1); Not with ordinary SQL. Two choices: 1. Code this into your application. 2. Write a function to create tables, which includes the insert. Then use only that function when creating your tables. But you will still need to restrict access to your application only, as any user who can connect directly to the database will be able to create tables directly. I would prefer solution 1. __________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com
Am Fre, 2003-05-16 um 22.12 schrieb Jeff Eckermann: > --- Yovko Ilchev Yovkov <yyovkov@vipsolutions.net> > wrote: > > Can anyone tell what I am in need of to do smthng > > like: > > When: CREATE TABLE table_1 (...); > > Automaticaly to execute: INSERT INTO TABLE newtables > > (name) VALUE (table_1); What about: CREATE TABLE table_1 as SELECT name FROM foo; -- e-Trolley Sayegh & John, Nabil Sayegh Tel.: 0700 etrolley /// 0700 38765539 Fax.: +49 69 8299381-8 PGP : www.e-trolley.de -- e-Trolley Sayegh & John, Nabil Sayegh Tel.: 0700 etrolley /// 0700 38765539 Fax.: +49 69 8299381-8 PGP : www.e-trolley.de
Am Fre, 2003-05-16 um 22.12 schrieb Jeff Eckermann: > --- Yovko Ilchev Yovkov <yyovkov@vipsolutions.net> > wrote: > > Can anyone tell what I am in need of to do smthng > > like: > > When: CREATE TABLE table_1 (...); > > Automaticaly to execute: INSERT INTO TABLE newtables > > (name) VALUE (table_1); What about: CREATE TABLE table_1 as SELECT name FROM foo; -- e-Trolley Sayegh & John, Nabil Sayegh Tel.: 0700 etrolley /// 0700 38765539 Fax.: +49 69 8299381-8 PGP : www.e-trolley.de