The data types %s and %s are incompatible in the %s operator.

Error Message:
Msg 402, Level 16, State 1, Line 3
The data types %s and %s are incompatible in the %s operator.

Severity level:
16.

Description:
This error message appears when you try to use an operator with incompatible values of incompatible data types for this operator.

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 data types must be compatible for the chosen operator.

Versions:
All versions of SQL Server.

Example(s):
DECLARE @bin BINARY(8)
SELECT @bin = CAST(GETDATE() AS BINARY(8))
SELECT CAST(@bin & CAST(1 AS BINARY(1)) AS DATETIME)

Remarks:
In the above example the error is raised because of the incompatibility between the operator & and the BINARY() data type.

]]>

Leave a comment

Your email address will not be published.