|
Log in | ||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Hello
I' have 2 tables T_VARPP et T_FORMPP I use T_VARPP to create T_FORMPP ex Table T_VARPPP VARPP = "Colonne 1" DESC = 'la premiere colonne ' Will create a table T_FORMPP with a column 'Colonne 1' type varchar(50) -figé- with a description 'la premiere colonne " All that is done in D7 and it works fine unfortunately I don't know how to keep uptodate T_FORMPP each time I modify T_VARPP DROP TRIGGER IF EXISTS "MAJVARPP"; CREATE TRIGGER MAJVARPP AFTER INSERT, DELETE ON VARPP REFERENCING OLD AS o NEW AS n BEGIN IF INSERTING THEN ALTER TABLE FORMPP ADD COLUMN n.VARPP VARCHAR(50) DESCRIPTION n.DESC ; //ELSEIF UPDATING THEN // ELSEIF DELETING THEN ALTER TABLE FORMPP DROP COLUMN o.VARPP ; END IF; END I got an syntax error on n.VARPP . What wrongs |
|
#2
|
|||
|
|||
|
That statement can not be used in this way.
Beside the fact that it's not allowed in NexusDB to perform DDL statements while a transaction is active (which is always the case during the execution of a trigger), if you take a look at the SQL standard: <add column definition> ::= ADD [ COLUMN ] <column definition> <column definition> ::= <column name> [ <data type or domain name> ] ... <column name> ::= <identifier> <identifier> ::= <actual identifier> <actual identifier> ::= <regular identifier> | <delimited identifier> | <Unicode delimited identifier> You can can clearly see that you need to specify an identifier as column name. You are instead trying to specify an expression which is totally invalid in this context. phd13 wrote: > Hello > I' have 2 tables T_VARPP et T_FORMPP > I use T_VARPP to create T_FORMPP > > ex Table T_VARPPP > VARPP = "Colonne 1" > DESC = 'la premiere colonne ' > Will create a table T_FORMPP > with a column 'Colonne 1' type varchar(50) -figi- with a description > 'la premiere colonne " > All that is done in D7 and it works fine > unfortunately I don't know how to keep uptodate T_FORMPP each time I > modify T_VARPP > > DROP TRIGGER IF EXISTS "MAJVARPP"; > > CREATE TRIGGER MAJVARPP > AFTER INSERT, DELETE ON VARPP > REFERENCING OLD AS o NEW AS n > BEGIN > IF INSERTING THEN > ALTER TABLE FORMPP ADD COLUMN n.VARPP VARCHAR(50) DESCRIPTION > n.DESC ; > //ELSEIF UPDATING THEN > // > ELSEIF DELETING THEN > ALTER TABLE FORMPP DROP COLUMN o.VARPP ; > END IF; > END > > I got an syntax error on n.VARPP . > What wrongs -- |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problem with Trigger | Matthew Balraj | nexusdb.public.support.adoprovider | 1 | 25th November 2009 10:48 PM |
| SQL Trigger How-To Question... | Shane Stump | nexusdb.public.support.sql | 9 | 24th June 2007 12:35 AM |
| Trigger help | Eric Noel | nexusdb.public.support.sql | 7 | 7th May 2006 08:52 AM |
| Trigger bug | Ole Willy Tuv | nexusdb.public.support.sql | 5 | 21st January 2006 02:45 PM |
| Can a trigger do this? | Dennis Landi | nexusdb.public.support.sql | 1 | 26th November 2005 01:28 AM |