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.
Select * from myTable where datein = Convert(datetime,'19/09/2006')In myTable I have Data that are Today and thequery above does not get itwhyIf it is that easy, everybody will be doing it
SwePeso
Patron Saint of Lost Yaks
30421 Posts
Posted - 2006-09-19 : 06:22:21
Try to use ISO dateformatSelect * from myTable where datein = Convert(datetime, '20060919')Peter LarssonHelsingborg, Sweden
Hariarul
Posting Yak Master
160 Posts
Posted - 2006-09-19 : 06:30:17
Try this ..Select * from myTable where datein = Convert(varchar(10),'19/09/2006',121)
OBINNA_EKE
Posting Yak Master
234 Posts
Posted - 2006-09-19 : 06:31:09
tHIS query is meant to be run everyday can I have Select * from myTable where datein = Convert(datetime, getdate()) - it does not workIf it is that easy, everybody will be doing it
SwePeso
Patron Saint of Lost Yaks
30421 Posts
Posted - 2006-09-19 : 06:33:17
GETDATE() already is DATETIME datatype. You have to remember that GETDATE() also includes TIME-information.What datatype is DateIN column?Try this
Select * from myTable where datein = DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)