Subject | Re: Firebird SQL - Alter table command (does it work?) - BUG? |
---|---|
Author | rrokytskyy |
Post date | 2002-04-25T22:28:13Z |
--- In Firebird-Java@y..., Sanjay Amatya <sanjayamatya@y...> wrote:
ALTER TABLE <table_name> ADD CONSTRAINT <constraint_name> PRIMARY KEY
(<col_name>[, <col_name>[,...]]);
Note, only columns with NOT NULL constraint are eligible for primary
or unique key.
Language Reference, that is available for download
(http://www.ibphoenix.com/downloads/60LangRef.zip) from
http://www.ibphoenix.com/ibp_download.html.
Best regards,
Roman Rokytskyy
> Create a database test.gdb. Create a table test with fieldsNo, syntax is:
> objectid (Integer), userid (Integer), name (Varchar). Then try to
> add primary key constraint to the first 2 fields:
>
> ALTER TABLE TEST ADD CONSTRAINT PRIMARY KEY PK_TEST
> (OBJECTID, USERINSTID);
>
> Doesn't work. Is this a bug of Firebird SQL?
ALTER TABLE <table_name> ADD CONSTRAINT <constraint_name> PRIMARY KEY
(<col_name>[, <col_name>[,...]]);
Note, only columns with NOT NULL constraint are eligible for primary
or unique key.
> I had a script that creates a number of tables then adds primaryYes, in script. For such situations I would recommend you to use
> key to fields. The script worked fine. Created tables. But no
> constraints added to table.
>
> BUG?
Language Reference, that is available for download
(http://www.ibphoenix.com/downloads/60LangRef.zip) from
http://www.ibphoenix.com/ibp_download.html.
Best regards,
Roman Rokytskyy