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)
 Datetime parameter

Author  Topic 

rkalyani
Starting Member

30 Posts

Posted - 2009-04-20 : 13:56:50
Hello,

I need to use a datetime parameter in my query. I have set up the parameter and it works fine and filters record based on the date. I need to now add time to this parameter. How do I do this?

Here is what I am trying and I get an error.

completed_date BETWEEN convert(datetime, @StartDate + '11:59:00 PM')AND convert(datetime, @EndDate + '12:00:00 AM') )



Thank you,
kal30

savior faire
Posting Yak Master

194 Posts

Posted - 2009-04-20 : 14:56:29
I believe you should be using the DATEADD date function. I just ran into a similar issue with a project using an end date parameter where I had to add a single day to it so that dates in a table that occur on the end date would get selected because they had a time component.

Talk sense to a fool and he calls you foolish.
Go to Top of Page

rkalyani
Starting Member

30 Posts

Posted - 2009-04-20 : 15:10:20
Thank you. I was able to fix my issue.

Thank you,
kal30
Go to Top of Page
   

- Advertisement -