Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Analysis Server and Reporting Services (2005)
 Between 2 Dates

Author  Topic 

CoachBarker
Posting Yak Master

170 Posts

Posted - 2009-02-05 : 09:32:48
have a query that when I run it in SQL Server Management it returns the correct dataset:

SELECT detail_record.detail_number, detail_record.ticket_number, detail_record.division, CAST(detail_record.pickup_dt AS datetime) AS PickupDate,
CAST(detail_record.deliver_dt AS datetime) AS DeliverDate, detail_record.customer_delv_to, detail_record.customer_bill_to,
cmBillTo.customer_number AS bill_to_number, cmBillTo.customer_name AS bill_to_name, cmBillTo.city AS bill_to_city,
cmDelvTo.customer_number AS deliver_to_number, cmDelvTo.customer_name AS deliver_to_name, cmDelvTo.city AS deliver_to_city,
detail_record.pickup_date, detail_record.grand_total_wt, hauler_master.hauler_number, hauler_master.hauler_name, hauler_master.city,
detail_record.ddp_weight, customer_master.customer_number
FROM detail_record INNER JOIN
customer_master AS cmBillTo ON detail_record.customer_bill_to = cmBillTo.customer_number INNER JOIN
customer_master AS cmDelvTo ON detail_record.customer_delv_to = cmDelvTo.customer_number INNER JOIN
hauler_master ON detail_record.hauler_number = hauler_master.hauler_number INNER JOIN
customer_master ON cmBillTo.customer_number = customer_master.customer_number AND
cmDelvTo.customer_number = customer_master.customer_number
WHERE (pickup_date BETWEEN @start_date AND @end_date) AND (customer_bill_to=@customer_number OR customer_delv_to=@customer_number)

ORDER BY detail_record.ticket_number


But when I run it in my report it doesn't.

I am trying to get the data between the @start_date (09/01/2008) and the @end_date(09/30/2008). In SQLServer when I run the query I get the right dataset, everything between 09/01/2008 and 09/30/2008. But in my report the query returns 09, 10, 11.

What am I doing wrong?



Thanks for the help
CoachBarker

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-02-05 : 11:49:51
by 09,10,11 do you means those months' data? Also is report parameter also datetime?Are you doing any filteration in report dataset or inside report containers?
Go to Top of Page

CoachBarker
Posting Yak Master

170 Posts

Posted - 2009-02-05 : 12:36:38
Instead of just getting September (09) I also get October(10), November(11) and probably December(12) if I dumped new data into the test DB. Yes the report parameters are also date time and I am doing no filtering in the report.

Thanks for the help
CoachBarker
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-02-06 : 10:04:15
are yousre the report parmeters are correctly matched onto query params?
Go to Top of Page

CoachBarker
Posting Yak Master

170 Posts

Posted - 2009-02-06 : 11:10:05
I got it to work, one of the report parameters was set wrong, now it just returns the date it is supposed to. Thanks for the help.

Thanks for the help
CoachBarker
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-02-07 : 08:51:47
welcome
Go to Top of Page
   

- Advertisement -