Click here to Skip to main content
14,865,252 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
when iam trying to retrive from to todate the data present in 'todate' is not retrieving

it displaying date before todate is displaying

suppose i select jan10 th

it displays data till jan 9th


what datatype we need to use in sql either datetime or smalldatetime
Posted
Comments
walterhevedeich 1-Aug-11 2:43am
   
Post your SQL script so we can understand your problem better.

1 solution

Try:
SQL
SELECT * FROM myTable WHERE myDate BETWEEN '2011-01-10' AND GETDATE()
This selects all dates between 10th Jan 2011 and today inclusive. If you need to exclude a date, you will need to code the WHERE clause differently:
SQL
SELECT * FROM myTable WHERE myDate > '2011-01-10' AND myDate <= GETDATE()
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900