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.
| Author |
Topic |
|
peace
Constraint Violating Yak Guru
420 Posts |
Posted - 2012-04-23 : 10:15:32
|
| My date datatype is DATETIME.MyDate2012-04-26 00:00:00.000How can I select a list of this date 2012-04-26 without the time using dateadd?It return 0 records when i run this:select * from tableName wheremydate = DATEADD(Day,3,Cast(getdate() as DateTime)) |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-04-23 : 10:22:50
|
dateadd(day, datediff(day, 0, getdate())or if you are using SQL 2008convert(date, getdate()) KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
peace
Constraint Violating Yak Guru
420 Posts |
Posted - 2012-04-23 : 10:24:33
|
| im using sql 2008i get this error using convertType date is not a defined system type |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-04-23 : 10:27:39
|
your comp level is probably not 100SELECT compatibility_levelFROM sys.databases WHERE name = '<DB NAME>'; use the dateadd(datediff()) method KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
peace
Constraint Violating Yak Guru
420 Posts |
Posted - 2012-04-23 : 10:40:15
|
| is 90got it.thanks! |
 |
|
|
|
|
|