I'm developing a stored procedure using dynamic sql and I keep getting the following error: Syntax error converting datetime from character string.
I'm passing a set of parameters to the sp with defaults
@ServiceCallStartDate ='2000-01-01',
@ServiceCallEndDate ='2003-12-31'
In my where clause I have:
IF @ServiceCallStartDate <> ''
set @v_Query = @v_Query + ' si.Order_Date > ''' + @ServiceCallStartDate + ''''
I have other parameters that are char datatypes and this format works fine.
Please help.
Thank you