I suggest you ...

In database projects, default constraints and prmary keys should be named

When you create a primary key or a default constraint in a database project it's unnamed by default. You can not even name it in the editor. You have to manually add CONSTRAINT [DF_blabla] to the line in the text editor.

It should name the these constraints by default.

3 votes
Sign in
Sign in with: facebook google
Signed in as (Sign out)
You have left! (?) (thinking…)
Hans E. Molin shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

Thank you for your suggestion! While we aim to respond to every suggestion, we are closing older ones that don’t have enough votes so newer ones from you can move to the top. If this suggestion is still important to you, feel free to open it again.


Sign in
Sign in with: facebook google
Signed in as (Sign out)
  • egnomerator commented  ·   ·  Flag as inappropriate

    I noticed this issue too. Here is how I handled it in the UI (using VS 2015):
    (I don't know when this became possible or if it was always possible)
    - I removed the primary key and then reset it
    - Upon resetting the primary key, it was automatically named as expected
    - So it seems that when initially creating the table, it's best to not set a primary key, then set the primary key once the table exists

  • Wesley Kenis commented  ·   ·  Flag as inappropriate

    I don't see why this suggestion is closed since it's probably listed multiple times unser a different name. I sure as **** want this in the next version. It's not because this bug is old that it's no longer relevant. And yes I call this a "bug" since this type of things would have come forth if your team would actually test their code and even better: think if their code makes any sense. During their test did nobody ever complain about this missing??? automated tests are convenient, but manual acceptance testing should have brought this up. Why not release a special version of the next release in a beta version. This will probably come back to bite you in the future.

  • Mikael commented  ·   ·  Flag as inappropriate

    1up on this.
    Updating databases is a pain when constraint names are not predictable. Especially when the database cannot be connected to directly via management studio.
    Making a copy of the database and generate scripts will still have problems since constraint names will differ and try to drop constraints that can't be found since names are auto generated on creation.
    Maybe next year... :(

Feedback and Knowledge Base