A nice little trick:
If you have a datetime field which has a date and a time in it, and you ony need the time, you can use the following code to cast it to a date only value:
select cast(floor(cast(getdate() as float)) as datetime)
This trick is useful for SQL 2005. SQL 2008 has a function for this issue.
No comments:
Post a Comment