professional web development and design
 

using date criteria in sql server

As you probably know, there is no "short" date value in SQL Server. This makes it difficult when you want to search for records based on a date criteria, such as "give me all the records that were created on January 17th, 2003.

One method is to cast the datefield first to a float, then to a date time such as the example below:
SELECT * FROM
	table
WHERE
	CAST(FLOOR(CAST(datefield AS float)) AS datetime)
		= '2002-01-17'

back to development articles back
Valid HTML 4.01