I recently wrote a stored procedure with those parameters:
@dFromDT DATE,
@dToDT DATE,
@sErrorMessage NVARCHAR(MAX),
@sPartCustom INT,
@sPartCustomFilter NVARCHAR(254),
@nIncludeMessage INT
I am trying to call the procedure with the line:
EXEC _MG_ERPPartFilter(CONVERT(datetime, '2013-01-01T00:00:00', 126), CONVERT(datetime, '2050-12-31T00:00:00', 126), '',5, '556', 0)
And I always get that error message:
Incorrect syntax near the keyword 'CONVERT'.
Even when I write this line:
EXEC _MG_ERPPartFilter('2013-01-01','2050-12-31', '',5, '556', 0)
I get that error:
Incorrect syntax near '2013-01-01'.
All the names are correct.
Can someone help me?
EXECcommand - you need to have only literal values or SQL Server variables. Use a SQL Server variable to hold the result of theCONVERTand then use that variable in yourEXECcall ...