February 25, 2022 at 3:50 pm
I am trying to pull records after 4:30 pm.
I am able to use this, but I don't think it works properly for minutes.
Does anyone know how do to this in MSSQL?
select a.accession_no,
a.created_date as "Date Created"
from accession_2 a
WHERE datename(hour, created_date) > 16.3
order by created_date desc
February 25, 2022 at 4:15 pm
I don't think any date functions return a decimal.
Either of these might work.
SELECT TOP 100 [name], create_date,
DATEPART(hour, create_date),
DATEPART(minute, create_date)
FROM SYS.OBJECTS
WHERE CONVERT(TIME(0), create_date) > '16:30:00';
SELECT TOP 100 [name], create_date,
DATEPART(hour, create_date),
DATEPART(minute, create_date)
FROM SYS.OBJECTS
WHERE (DATEPART(hour, create_date) = 16 AND DATEPART(minute, create_date) >= 30 AND DATEPART(second,create_date) >0)
OR ( DATEPART(hour, create_date) > 16);
February 25, 2022 at 10:03 pm
Thank you! This worked great!
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply