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
 General SQL Server Forums
 New to SQL Server Programming
 Date return for today only

Author  Topic 

danjapro
Starting Member

44 Posts

Posted - 2006-05-30 : 15:29:49
I am trying to get the Date field in my SQL Query to only return.

Date that match todays date.

this is waht I have but it produces an error.

WHERE
(EsnAsset.EffectiveDate LIKE DateTime.Now)

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-05-30 : 15:46:00
WHERE EsnAsset.EffectiveDate >= DATEADD(Day, DATEDIFF(Day, 0, GetDate()), 0) AND
EsnAsset.EffectiveDate < DATEADD(Day, DATEDIFF(Day, 0, GetDate()) + 1, 0)


Tara Kizer
aka tduggan
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-05-31 : 01:39:17
Read more about querying on dates
http://www.sql-server-performance.com/fk_datetime.asp

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -