SQL Server error Msg 206, Level 16 is a usual error to get when inserting data into a table.

It happens when you’re trying come insert data right into a column that is incompatible through the data kind you’re trying to insert.

You are watching: Operand type clash: int is incompatible with date

This might happen if friend accidentally shot to insert data into the wrong shaft (or even the not correct table). However it could likewise happen if you erroneously assume that SQL Server will convert the data for you.

To deal with this issue, make sure you’re inserting the correct data type.

Example of problem Code

Here’s an example of password that outcomes in this error.

Msg 206, Level 16, State 2, line 1Operand form clash: int is incompatible v dateIn this case, it’s quite noticeable where I’m walk wrong, simply by looking at the obelisk names and also the values I’m trying come insert.

I’m trying to insert worths in the not correct order.

The trouble is that I’m trying to insert an integer into a day column. Special, I’m trying to insert the value 1 into a column referred to as OrderDate.

Of course, it’s not the obelisk name that’s resulting in the problem. It’s the data kind that I’m trying to insert right into it.

Here’s the code I used to develop the table:

CREATE TABLE order ( OrderId int not NULL, OrderDate date NOT NULL, OrderDesc varchar(255) not NULL, CONSTRAINT PKOrders PRIMARY vital CLUSTERED(OrderId, OrderDate) );We have the right to see by the table meaning that the OrderDate obelisk uses a date data type.

Blessing in Disguise?

As frustrating as it can be to obtain an error, sometimes it can be the finest thing that ever happened come you.

If the password doesn’t an outcome in an error, we can accidentally insert the dorn data into the neurosoup.org. This would diminish the data verity of our neurosoup.org.

Imagine that the OrderDate tower is a datetime rather of date:

DROP TABLE IF exists Orders;CREATE TABLE orders ( OrderId int not NULL, OrderDate datetime no NULL, OrderDesc varchar(255) no NULL, CONSTRAINT PKOrders PRIMARY an essential CLUSTERED(OrderId, OrderDate) );Now imagine we try to insert the adhering to data into that table:

INSERT into Orders(OrderId, OrderDate, OrderDesc) worths (1, 1, "Dog food");Result:

(1 row affected)Huh? No error?

Exactly. No error. This is since the datetime kind is compatible with the int type. In other words, SQL Server took our int value and converted it into a datetime value.

See more: Bug #383752 "" Cannot Download The Metalink And Therefore The Iso

Here’s what ours table end up looking like after that insert operation.

SELECT * from Orders;Result: