I have created a stored procedure successfully. When I execute this procedure by passing parameters it throws the following exception:
Msg 102, Level 15, State 1, Line 9
Incorrect syntax near '-'
DECLARE @return_value int
EXEC @return_value = [dbo].[spJobsGet]
@Email = Nemail@example.com',
@Password = N'password',
@JobSheetID = 0,
@PropertyID = 0,
@DateFrom = 2014-06-20,
@DateTo = 2014-07-20
SELECT 'Return Value' = @return_value
You need to put quotes around your date string literals:
@DateFrom = '2014-06-20', @DateTo = '2014-07-20'
You should be aware that the format you are using can be ambiguous, a better option would be
@DateFrom = '20140620', @DateTo = '20140720'
which is always interpreted as YYYYMMDD.