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 ?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top