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 |
|
khufiamalik
Posting Yak Master
120 Posts |
Posted - 2008-10-18 : 00:34:57
|
| Hello All, I have a Datetime field in my Database. When I store Current Date by GetDate() function, date and time are stored in field.I have no issue with this datetime but When I use this field in my Where Clause, it does not give me the result.Like if I write Query Like ThisSelect * from Employee Where JoiningDate=GetDate()this will not return any row even if there are few employees who have joined today.Can any one tell me that how can I ignore the Time part from Date Time field in Where Caluse |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-18 : 00:39:31
|
| use this to get employees joined todaySelect * from Employee Where JoiningDate>DATEADD(dd,DATEDIFF(dd,0,GetDate()),0) |
 |
|
|
khufiamalik
Posting Yak Master
120 Posts |
Posted - 2008-10-18 : 00:43:23
|
| Thanks Alot |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-18 : 00:45:35
|
quote: Originally posted by khufiamalik Thanks Alot
welcome |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-10-18 : 03:15:56
|
quote: Originally posted by visakh16 use this to get employees joined todaySelect * from Employee Where JoiningDate>DATEADD(dd,DATEDIFF(dd,0,GetDate()),0)
Select * from Employee Where JoiningDate>=DATEADD(dd,DATEDIFF(dd,0,GetDate()),0) ANDJoiningDate<DATEADD(dd,DATEDIFF(dd,0,GetDate()),1)MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|