Column already has a DEFAULT bound to it.

Error Message:
Msg 1781, Level 16, State 1, Line 1
Column already has a DEFAULT bound to it.

Severity level:
16.

Description:
This error message appears when you try to create a DEFAULTconstraint for a column, for which already a DEFAULT constraint was declared.

Consequences:
The T-SQL statement can be parsed, but causes the error at runtime.

Resolution:
Error of the Severity level 16 are generated by the user and can be fixed by the SQL Server user. There can only be one DEFAULT constraint for each column.

Versions:
All versions of SQL Server.

Example(s):
CREATE TABLE t
(
 c1 INT DEFAULT 0
)
GO
ALTER TABLE t
 ADD CONSTRAINT DF_c1 DEFAULT (1) FOR c1
DROP TABLE t

Remarks:
It is not possible to create more than 1 DEFAULT constraint for a single column. No matter if you try to do so directly in the CREATE TABLE statement or afterwards via ALTER TABLE. However, if you try to do so in a CREATE TABLE statement, SQL Server raises error 8148.




Related Articles :

  • No Related Articles Found

No comments yet... Be the first to leave a reply!

Software Reviews | Book Reviews | FAQs | Tips | Articles | Performance Tuning | Audit | BI | Clustering | Developer | Reporting | DBA | ASP.NET Ado | Views tips | | Developer FAQs | Replication Tips | OS Tips | Misc Tips | Index Tuning Tips | Hints Tips | High Availability Tips | Hardware Tips | ETL Tips | Components Tips | Configuration Tips | App Dev Tips | OLAP Tips | Admin Tips | Software Reviews | Error | Clustering FAQs | Performance Tuning FAQs | DBA FAQs |