Simple DateTime sql query

前端 未结 8 535
借酒劲吻你
借酒劲吻你 2020-12-07 21:42

How do I query DateTime database field within a certain range?

I am using SQL SERVER 2005

Error code below

SELECT * 
  FROM TABLENAME 
 WHERE         


        
8条回答
  •  执笔经年
    2020-12-07 22:31

    SELECT * 
      FROM TABLENAME 
     WHERE [DateTime] >= '2011-04-12 12:00:00 AM'
       AND [DateTime] <= '2011-05-25 3:35:04 AM'
    

    If this doesn't work, please script out your table and post it here. this will help us get you the correct answer quickly.

提交回复
热议问题