Board index » delphi » name of interbase primary keys
Jaime Escobal
![]() Delphi Developer |
Sun, 15 Feb 2004 23:45:24 GMT
|
Jaime Escobal
![]() Delphi Developer |
Sun, 15 Feb 2004 23:45:24 GMT
name of interbase primary keys
Hi friends,
I have noticed that primary keys in interbase have this name: RDB$PRIMARYNN, where NN is a number. I have also noticed that this number depends on the order of creation of the tables. I need a name for the primary key that does not depend on this, so I can use it in my programs. Can anybody help me with this? Thanks a lot for any help. Jaime Escobal |
Martijn Tonie
![]() Delphi Developer |
Mon, 16 Feb 2004 02:00:26 GMT
Re:name of interbase primary keysYou can name primary keys (and other constraints) by supplying a name for it. Download the IB6 beta documentation set at http://www.borland.com/techpubs/interbase/ and check the Language Reference for the exact syntax. Btw, InterBase Workbench (http://www.interbaseworkbench.com) automatically -- Upscene Productions "This is an object-oriented system. Quote"Jaime Escobal" <jaime.esco...@laviga.com> wrote in message Quote> Hi friends, |
Robert Schiec
![]() Delphi Developer |
Sun, 15 Feb 2004 20:39:41 GMT
Re:name of interbase primary keysQuoteIn article <3B8D0E14.B3492...@laviga.com>, Jaime Escobal wrote: the primary key field using 'create index'. The results will be the same but you get to name the index. Robert Schieck (TeamB) |
Jaime Escoba
![]() Delphi Developer |
Mon, 16 Feb 2004 06:26:27 GMT
Re:name of interbase primary keysThanks for your advice Martijn, but I cannot seem to find the info on the manual, or I do not understand it well? could you help me with this? thanks a lot jaime QuoteMartijn Tonies wrote: |
Jaime Escoba
![]() Delphi Developer |
Mon, 16 Feb 2004 06:29:16 GMT
Re:name of interbase primary keysHi Robert, I did this but I have problems with the FOREIGN KEY references to the original PRIMARY KEYS. Is there anything besides this I should consider? Thanks a lot, Jaime QuoteRobert Schieck wrote: |
Sergio Samayo
![]() Delphi Developer |
Mon, 16 Feb 2004 09:58:04 GMT
Re:name of interbase primary keysYou can name the FK constraint but not the index used to check the constraint. To relate a table via FK, target table must have a PK constraint, then is if you create an unique index, that index isn't related to the constraint then you can't create the FK. You must decide if you can oive with the system named constraint index created by PK, FK or UNIQUE constraints and let the server to do the referential check, or use your own named index but check referential check from client side or using triggers (that is the way Robert does I think). There is a hack to use user named index but it appears that is lost with backup/restore. I dislike the name IB gives to RI constraints but I preffer that than do RI checking manually. -- "Jaime Escobal" <jaime.esco...@laviga.com> escribi en el mensaje Quote> Thanks for your advice Martijn, but I cannot seem to find the info on the |
Ronald Ma
![]() Delphi Developer |
Mon, 16 Feb 2004 15:42:31 GMT
Re:name of interbase primary keysQuoteJaime Escobal wrote: (1) CREATE TABLE Invoice ( Invoice_No VARCHAR(20) NOT NULL, CONSTRAINT XPKInvoice PRIMARY KEY (Invoice_No) ); (2) ALTER TABLE Invoice Ronald |
Sergio Samayo
![]() Delphi Developer |
Mon, 16 Feb 2004 22:25:17 GMT
Re:name of interbase primary keysHe is talking about the index name that is created to enforce the constraint not the constraint name. -- "Ronald Mak" <ron...@apsnet.com.hk> escribi en el mensaje Quote> Jaime Escobal wrote: |
Jaime Escoba
![]() Delphi Developer |
Wed, 18 Feb 2004 01:24:56 GMT
Re:name of interbase primary keysHi friends, Following your advice, I created the table with the primary key AND a unique key with the same columns of the primary key. That way, I thought, I could have both the primary keys and a key with a name I new beforehand. and I could also have the foreign keys. but IB does not allow me to declare the foreing keys under this scenario (strange).. If I delete the foreign key clause, IBt creates the table.... So for now I am not using foreign keys, but I would like to have them. anyway, thanks for your help Jaime Escobal QuoteSergio Samayoa wrote: |
1. Primary key or not primary key.........
2. Getting the primary key index name.
3. how to get primary key field name use ADO
4. Names of primary keys columns
5. How to control the name of an index associated to a primary key constraint
8. Interbase - Can't add primary key to table