Subject Re: Differences when adding a Primary Key
Author Walter R. Ojeda Valiente
Nobody knows?

Nobody has any idea?

Greetings.

Walter.


On Thu, Aug 20, 2015 at 10:45 AM, Walter R. Ojeda Valiente <sistemas2000profesional@...> wrote:
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.