all groups > sql server reporting services > october 2005 >
You're in the

sql server reporting services

group:

Date parameters in ="select.......where creationdate="&...."


RE: Date parameters in ="select.......where creationdate="&...." Rama Prasad
10/18/2005 5:15:02 AM
sql server reporting services:
Where you are writing the statemnt? In report or in stored procedure ?

If it is in report itself you can do as given belo:

If you declare ReceiveDate as DateTime Type. you can write the sql statement
directly .
Select ........ Where creationdate = @ReceiveDate

If you Declare it as String then you need to use date conversion function
Select ........ Where creationdate = CDate(@ReceiveDate)

Re: Date parameters in ="select.......where creationdate="&...." Bruce L-C [MVP]
10/18/2005 7:46:03 AM
I think the issue here is that you are using an expression which is really a
mistake unless there is no other way. If you use the generic query designer
(two pane) then just do this:

select .... where creationdate = @ReceiveDate

You don't have to do anything special. RS takes care of everything. If you
use an expression then you have to do a lot more (for instance, embed single
quotes).


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services

[quoted text, click to view]

Date parameters in ="select.......where creationdate="&...." Ludo Van Dun
10/18/2005 1:48:33 PM
Hi there,
I'm looking for the correct syntax for using datetime parameters in the SQL
statement.

The parameter is called ReceiveDate and defaults to =Today()

="select ........ where creationdate = "&......

Thanks
Ludo

Re: Date parameters in ="select.......where creationdate="&...." Bruce L-C [MVP]
10/19/2005 8:50:43 AM
This is very odd. RS should be handling this. There is no reason for you to
have to use CDate or anything like that. Try changing your SQL to be like
this:

select part_number,serial_number from UNIT_STATUS_V where creation_time >=
@StartDate and creation_time <= @EndDate

You definitely should be able to have the parameter be a datetime.


--
Bruce Loehle-Conger
MVP SQL Server Reporting Services


[quoted text, click to view]

Re: Date parameters in ="select.......where creationdate="&...." Ludo Van Dun
10/19/2005 10:52:25 AM
Thanks,
it is in the report (RS 2005). It works when I put the parameter to string
and use query:

select part_number,serial_number from UNIT_STATUS_V where creation_time
between @StartDate and @EndDate

creation_time is a DateTime field.

But I'd rather use the parameter as a DateTime as well since then I get a
calender pick control.

I tried using CDate but with no result so far...

Ludo




[quoted text, click to view]

Re: Date parameters in ="select.......where creationdate="&...." Ludo Van Dun
10/19/2005 10:53:45 AM
Thanks,
it is in the report (RS 2005). It works when I put the parameter to string
and use query:

select part_number,serial_number from UNIT_STATUS_V where creation_time
between @StartDate and @EndDate

creation_time is a DateTime field.

But I'd rather use the parameter as a DateTime as well since then I get a
calender pick control.

I tried using CDate but with no result so far...

Ludo



[quoted text, click to view]

Re: Date parameters in ="select.......where creationdate="&...." Ludo Van Dun
10/20/2005 8:54:15 AM
Hi again.....
thanks for your help so far, I found the problem and I'll try to explain.
My date settings are set to british "dd/MM/yyyy". When I do the preview of
the report the EndDate parameter defaults to =DateAdd("d",-1,Today()) and
the StartDate to =Today(). The readable fields read 19/10/2005 and
20/10/2005 which look fine. When I click on the preview tab the report runs
but when I click on view report the system returns an erro on the date
parameter. Now...when I select a date in the calender picker the readable
fields shows the date correctly like dd/MM/yyyy but the report returns the
same error. But when I select fi 08/08/2005 till 09/08/2005 and I click
view report the report runs and the 2 visible fields previously filled by
the calender picker change to 08/08/2005 till 08/09/2005 so the reports runs
from august 8th till september 8th ....I don't know the reason but when I
deploy the report it seems to run correctly, so the problem only occurs in
the preview.....
Could this be a bug in the RS 2005 or do you know some settings I need to
check ?

Anyway many thanks for your help.

Ludo Van Dun


[quoted text, click to view]

AddThis Social Bookmark Button