SSRS 2008 DateTime picker to UNIX/EPOCH field
-
Saturday, March 02, 2013 6:37 PM
Im trying to write a report that presents data based on a date range(selected by the person running the report) using SQL Server reporting.
I build the start date and the end date as parameters and as a selectable date/Time data type and create a dataset with the following simple query:
SELECT callclass AS CallType, COUNT(callclass) AS Total
FROM opencall
WHERE (companyname = @name) AND (status <> 17) AND (logdate >= @StartDate) AND (logdate <= @EndDate)
GROUP BY callclass
The problem I have is that the logdate field is stored as an EPOCH/UNIX value and therefore the report does not run. How can I get the date/time picker to convert the selected value into an epoch string and return the correct data for the date range selected? Help muchly appreciated.
All Replies
-
Saturday, March 02, 2013 9:27 PM
BETWEEN DATEDIFF(second, '1970-01-01 00:00:00', @StartDate) AND DATEDIFF(second, '1970-01-01 00:00:00', @EndDate)
for UTC.. not taking into consideration your local time zone
Thanks! Josh Ash
- Marked As Answer by Sylove1 Saturday, March 02, 2013 10:46 PM
-
Saturday, March 02, 2013 9:58 PM
Thanks very much for your reply Josh
Im a bit of a newbie to this SQL lark - hence the basic query in the first place. Where would you place the BETWEEN in my syntax?
-
Saturday, March 02, 2013 10:45 PM
Its ok Josh, I was being thick. All working. Thankyou very much for your assistance. Ive been trying to get to the bottom of that for hours!!
Thanks again

