Question:
How can I set up an SQL query to return data whenever a historic field of type date/time has a certain value?
Solution:
For a Microsoft SQL Server database, use DATEPART function. In the example below, the Query returns all table’s fields when the data field’s value (in minutes) is equal to 30:
SELECT *
From [TableName]
Where DATEPART(MINUTE, data) = 30