Mobile Line Of Business

Richard Jones (MVP)

  Home  |   Contact  |   Syndication    |   Login
  202 Posts | 0 Stories | 36 Comments | 0 Trackbacks


Welcome to the Mobile Line Of Business Blog

Tag Cloud

Article Categories


Post Categories

Image Galleries


Ever needed to-do this in SQL?

select * from ATABLE


Now suppose that you want to ignore times as SQL Server's DateTime object stores the time along with the date.

You can modify the query to-do just this.

select * from ATABLE

CAST(FLOOR(CAST( [SomeDate] AS float)) AS datetime) = @A_DATE_YOU_WANT_TO_LOOKFO


Obviously the variable @A_DATE_YOU_WANT_TO_LOOKFO should  have its time set to midnight,  but this works great.

posted on Sunday, November 23, 2008 8:41 AM