Fix “date is incompatible with int” in SQL Server when Adding to or Subtracting from a Date

If you’re getting error message “Msg 206” that reads “Operand type clash: date is incompatible with int” in SQL Server while trying to add to (or subtract from) a date, it’s probably because you’re trying to perform arithmetic between an integer and a date value.

To fix this issue, either change the date value to a datetime value or use the DATEADD() function.

Continue reading

How to Get Values That Don’t Contain Numbers in SQL Server

If you have a column in a SQL Server database table that contains character data, but some rows also contain numbers within that data, you can use the following technique to return just those rows that don’t contain numbers.

Numbers can be represented by words and other symbols, but for the purpose of this article, “number” means “numerical digit”. So we’re finding values that don’t contain any numerical digits.

Continue reading