Groups | Blog | Home
all groups > sql server reporting services > may 2007 >

sql server reporting services : Can't use integer parameter with dateadd?


bjkaledas
5/11/2007 11:50:00 AM
Hey guys I have the following in my SQL statement:

DATEADD(hh, @hours, @startTime)

hours is an integer and startTime is actually a string, but the thing is
that this statement works fine if I use it like this:

DATEADD(hh, 8, @startTime)

The first version is what I need so that the user can control from a
parameter and I get the following error:


Error Source: System.Data
Error Message: Failed to convert parameter value from a Decimal to a DateTime.

Thanks!

BJ
EMartinez
5/11/2007 6:59:43 PM
On May 11, 1:50 pm, bjkaledas <bjkale...@discussions.microsoft.com>
[quoted text, click to view]


You might need to do something like this:
DATEADD(hh, @hours, CAST(@startTime AS DATETIME))
- or- something like this in the report:
=Dateadd("h", Parameters!Hours.Value, CDate(Fields!startTime.Value))
Hope this helps.

Regards,

Enrique Martinez
Sr. Software Consultant

AddThis Social Bookmark Button