Column names in each table must be unique. Column name ‘%.*ls’ in table ‘%.*ls’ is specified more than once.

Error Message:
Msg 2705, Level 16, State 3, Line 1
Column names in each table must be unique. Column name ‘%.*ls’ in table ‘%.*ls’ is specified more than once.

Severity level:
16.

Description:
This error message appears when you try to specify a name for a column more than once upon creation of a table.

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. The statement cannot be executed this way. Columns names within a table must be unique.

Versions:
All versions of SQL Server

Example(s):
USE tempdb;
GO
IF OBJECT_ID(‘tempdb..#t’) > 0
 DROP TABLE #t
GO
CREATE TABLE #t
(
 id INT
 CONSTRAINT PK_t PRIMARY KEY,
 id INT
)

Remarks:
In the above example we try to use the name ID for more than one column in the same table. This raises the error.




Array

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