• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 242
  • Last Modified:

How to select in between datetime in MSSQL?


I have a table need to select the data within a period.
For example, today is 2009-04-16, if I use the following SQL, it cannot select the data on 2009-04-16

If I change it to 2009-04-17, it can select. How should I write the SQL?

select * from transactions where transactiondatetime >='2009-04-10' and transactiondatetime <= '2009-04-16'

Open in new window

1 Solution
Pratima PharandeCommented:
select * from transactions where convert(varchar(10),transactiondatetime,111) >='2009/04/10' and convert(varchar(10),transactiondatetime,111) <= '2009/04/16'

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now