Error converting data type varchar to datetime in Stored Procedure

You don't put the parameters in quotes. Remove the single quotes from around the parameters.

EXEC Db.[dbo].[StoredProc2] @StartDate , @EndDate

When you use variables for the parameters you don't put them in quotes, you just use the parameters and the correct way will be interpreted by the engine.

2 Likes