From and To Date Filtering

I have been recently creating few reports that required dates as parameters. It is quite common to have a report that must be provided with from and to date range.

When I see two dates that must be provided to a report I believe that when I provide the same date in from and to parameters it will show all data for the particular day. 

But in my case it failed. After going through different queries, I came up with a solution which is below
SELECT *
FROM tbl_Employee 
WHERE DOJ >= DATEADD(dd, 0, DATEDIFF(dd, 0, @InFromDate))
    AND DOJ < DATEADD(dd, 1, DATEDIFF(dd, 0, @InToDate))

0 comments:

Twitter Delicious Facebook Digg Stumbleupon Favorites More