Subject | Differences when adding a Primary Key |
---|---|
Author | Walter R. Ojeda Valiente |
Post date | 2015-08-20T14:45:44Z |
Hello everybody
For add a Primary Key to a table we can write:
ALTER TABLE MyTable ADD PRIMARY KEY (ID);
or we can write:
ALTER TABLE MyTable ADD CONSTRAINT MyPK PRIMARY KEY (ID);
In the first case, the Firebird puts the name of the Primary Key, in the second case we choose that name, but...
Why sometimes the first case fails and the second case always work?
Of course that the table has not a Primary Key yet and the ID column has not nulls neither duplicated values.
But (just sometimes) the first case fails.
Greetings.
Walter.