How can I execute this:

accesser2003

Registered User.
Local time
Today, 19:33
Joined
Jun 2, 2007
Messages
124
I have a stored procedure "BuildAttendanceEvents_GroupByEmp". It has two parameters: @loadfrom datetime, @loadto datetime.

I want to execute this procedure with the two parameters:
LoadFrom: "30/12/2007"
LoadTo: "15/01/2008"

When I write the following SQL statement to execute the stored procedure:
exec BuildAttendanceEvents_GroupByEmp "30/12/2007","15/01/2008";

The following error appeared:
Server: Msg 8114, Level 16, State 4, Procedure BuildAttendanceEvents_GroupByEmp, Line 0
Error converting data type nvarchar to datetime.

How can I execute it without error?
 
Try:
exec BuildAttendanceEvents_GroupByEmp cdate("30/12/2007"),cdate("15/01/2008")
 
The following error is given
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '30/12/2007'.
 
That looks like a European Date format that you are using. I think I read somewhere that cdate likes US Date formats. You might want to try it as

"12/30/2007","01/15/2008"
 

Users who are viewing this thread

Back
Top Bottom