Monday, 15 March 2010

SQL query using Date and Time -


I need some help with query

I use GETDATE as of today's date I would like to do and specify from 6:00 AM to 6:00 PM

For example, something like this:

where "current date 06:00:00" And "current date 18:00:00" between t_stamp

GETDATE this SQL server Appears to indicate - Please include this information in the future.

One of several ways will be:

  where t_stamp between the convert (DATETIME, CONVERT (VARCHAR (10), GETDATE (), 126) + 'T06: 00: 00 ', 126) and convert (DATETIME, CONVERT (VARCHAR (10), GETDATE (), 126) +' T18: 00: 00 ', 126)   

Strange I know There are a million different passages of the same answer.

No comments:

Post a Comment