Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
I feel dreadful asking this simple question:I have a column: MyDateTime DateTime (8)Now I want to retrive data where MyDateTime is greater than 01/02/2006.SELECT *FROM MyTableWHERE (MyDateTime > 01 / 02 / 2006)However, this statement is not working properly. I get all the rows where MyDateTime is less than 01/02/2006Can someone help me writing the correct statementThanks
khtan
In (Som, Ni, Yak)
17689 Posts
Posted - 2006-02-02 : 08:08:13
>> Now I want to retrive data where MyDateTime is greater than 01/02/2006.01/02/2006 is MM/DD/YYYY or DD/MM/YYYYAdvicable to specify your date in YYYY-MM-DD
SELECT * FROM MyTable WHERE MyDateTime > '2006-01-02'
or
SELECT * FROM MyTable WHERE MyDateTime > '2006-02-01'