View Full Version : How can I execute this:


accesser2003
07-16-2008, 10:25 AM
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?

FoFa
07-16-2008, 10:33 AM
Try:
exec BuildAttendanceEvents_GroupByEmp cdate("30/12/2007"),cdate("15/01/2008")

accesser2003
07-16-2008, 11:41 AM
The following error is given
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '30/12/2007'.

MSAccessRookie
07-16-2008, 11:49 AM
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"