user6167266 user6167266 - 2 months ago 6x
SQL Question

smalldatetime comparison SQL Server

I have a smalldatetime field in my SQL database. The SQL format for this is type is : yyyy-mm-dd hh:mm:ss

I need to query my database and request all records where the date matches today's date AND the time portion is 100 minutes from the present time.

Help with the SQL would be greatly appreciated.

Thank you.


You could try something like this

SELECT * FROM TABLE WHERE DateField = CONVERT(smalldatetime,dateadd(MINUTE,100,getdate()),120)