Message
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
Other
Title:
How to use dates in WHERE in SQL Server
Miscellaneous
Thread ID:
01322704
Message ID:
01322704
Views:
65
Good evening,

I have run into a little issue with retrieving data from SQL Server using WHERE containing DATE. Obviously the SQL Server has the date in the DATETIME format. I want to create a string that will have WHERE to retrieve records within a date range. Here is a simple version of what I tried:
cSqlCommand = "select * from mytable where myDateTimeField >= ?06/01/2008"
But I don't get the records that I am supposed to get. That is, I get records where DATE portion of them is before 6/1/2008.

What am I missing?

Thank you in advance for any help.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Next
Reply
Map
View