Question

When generating a diff script between two dbschema with vsdbcmd.exe, I sometime obtain an unexpected output, containing some drop constraint without the name of the constraint :

GO
PRINT N'Dropping On column: ColumnName ...';    

GO
ALTER TABLE TableName DROP CONSTRAINT ;

In our schema, this column has a default value constraint, with an auto generated name. I expected vsdbcmd.exe to generate a valid ALTER TABLE sql statement, as specified in the msdn library :

ALTER TABLE [ database_name . [ schema_name ] . | schema_name . ] table_name DROP { [ CONSTRAINT ] constraint_name | COLUMN column_name }

Do you have any idea of what could prevent vsdbcmd.exe to generate a valid sql statement ?

Was it helpful?

Solution

This issue only occurs when the constraint has a generated name. Explicitly named constraint are not impacted. Therefore, this solution is to name every constraint.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top