Re:ERROR :Msg 8117, Level 16, State 1, Line 37 Operand data type varchar is invalid for minus operator. View Post

[Full Discussion]
Emeka Okeke Author Jan 23, 2020
0

The second argument of the DATEADD system function must be a numeric integer type. This means it must be a whole number like 1,2,3,4... etc and not a string in your case.

The problem with your query is that you passed string-typed variable @RefreshDays to the DATEADD function.

The error message:

ERROR :Msg 8117, Level 16, State 1, Line 37 Operand data type varchar is invalid for minus operator.

simply means that you tried to use the minus sign for a string variable -@RefreshDays instead of a numeric variable which is what the DATEADD function expected at that argument position - that is the second argument/parameter