The SQL statement for comparing time in access is simple, such as select * from table where thetime> # "& now () &" #.
This is not the case in MSSQL. Use the datediff statement and the getdate () function for comparison.
For example, if select count (*) from table where datediff (S, getdate (), thetime)> 0, I made a special 0.5 million-piece data table, it takes about 1200 milliseconds to execute this statement.
Later, I studied it and found that the datediff function is not required. You can use> to compare it directly. The statement is as follows: Select count (*) from table where thetime> getdate (), in this way, it takes about 750 milliseconds, which is nearly 500 milliseconds faster.
One day later
Select * From Table1 where datefieldname> '2017-3-29'
Within a certain period of time
Select * From Table1 where datefieldname between '2017-3-29 'and '2017-4-10'
In the last three days
Select * From Table1 where datediff (D, datefieldname, getdate () <3