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
Awesome!! You are now a member of HelpLeap community. Click button below to visit your portal to manage your posts and comments.
Sign up to write awesome helpful posts, and leave useful comments and questions for the community!
Log in to write awesome helpful post, and leave useful comments and questions for the community!