##[error]Warning SQL72017: The unnamed foreign key between tables [Config].[Y] and [Config]. [X] will be checked by checking the table. Name the foreign key to avoid checking the entire table and only check the new constraint

Ravi Alwal 20 Reputation points
2024-05-13T14:12:18.05+00:00

I am getting subject error while deploying Azure SQL Server DBProject

Please help me the to resolved this error.

Azure SQL Database
{count} votes

1 answer

Sort by: Most helpful
  1. Amira Bedhiafi 16,306 Reputation points
    2024-05-13T22:10:18.73+00:00

    Based on this old thread :

    Posting this same question on dba.SE.com and I got this response

    How To Drop An Unnamed Constraint in SQL Server If you do not specify a name, SQL will generate a random name built from a prefix which denotes the type of constraint, and partial table and column names followed by a random alphanumeric string. It would normally look something like this:

    `DF__MyTable__MyColu__3F3159AB
    `
    

    .

    Cleaning Up SQL Server Deployment Scripts in the DRI Objects with "Junk" names section For example, if a Primary Key is created but left unnamed, SQL Server uses a default auto-generated name, PK__TableName__Junk (for example, PK__Customer__A4AE64082CE326F2). This will cause SQL Compare to drop the Primary Key and recreate it, because the Junk portion of its name will be different on different databases. This means that even though there has been no functional change, any change scripts generated using comparison software will, upon every new build, attempt to remove the 'old' constraint and add the 'new' one. Dropping and recreating a primary key on a table can be a very costly operation and since there has been no functional change, one that we can well live without.

    .

    Dan Jones blog: Best Practice: Naming Constraints The bottom line is don’t be a lazy DBA/Programmer and let the system name your constraints. The few extra taps on the keyboard will be worth it in the long run. In fact, this might become part of my standard arsenal of DBA interview questions: do you name your constraints? Or something like that.

    0 comments No comments