How can I compare a Date to the DATETIME value stored in SQL Server and how can I perform quarterly calculations?

Filed under: Transact-SQL (T-SQL) — Ari Weil at 9:43 am on Monday, November 26, 2007

There is a TON to consider when dealing with dates. Still, things don’t have to be too difficult. Once you know the business your code will serve you have to then decide which date format you should use (look at the CONVERT function in books online and you’ll see that you can choose any format from USA with or without the century (mm-dd-yy | mm-dd-yyyy) to ODBC Canonical (yyyy-mm-dd hh:mi:ss(24h)) with many in between. The Internet is filled with examples of code that will format date values for you (like the FormatDate function in SQL Server Magazine InstantDoc 96608).

There is a great article that deals with all sorts of date conversions, comparisons and calculations on www.databasejournal.com. This should be right up your alley!

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>