SQL Date Comparison
Here's how to get 0 hours today in SQL
SELECT (CAST(FLOOR(CAST(GETDATE() as FLOAT)) AS DateTime))
Just compare your time with this.
Don't use varchar casts as they are slow.
Check this listing for more date reference.
source to share
Do you mean the datatype of the column you were using is "TimeStamp" and not dateTime or smalldatetime?
If so, you're out of luck. This datatype has nothing to do with dates or times (it's really misleading ...) It's just guaranteed to be chronologically unique and consistent ... But there is no way to compare it to datetime
http://msdn.microsoft.com/en-us/library/aa260631(SQL.80).aspx
http://www.sqlteam.com/article/timestamps-vs-datetime-data-types
source to share
If ColumnName (the column you are studying) is of datetime datatype and NOT timestamp, then the fastest approach is
Select Case DateDiff(day, columnName, getDate())
When 0 Then 'Today' Else 'Earlier' End
From TableName
assuming all date values in ColumnName are now or earlier ...
The easiest way to think of a datiff is that it counts the number of "boundaries" of the specified type that you must pass in order to move from one day to the next ...
source to share