![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a datetime field in a SQL SERVER and I need to know clients that are scheduled for the next day when reading the info on the current day. I have tried [tblevent].[begin_datetime] = dateadd(d,1,getdate()) within the where clause and this does not return any records. I know that the records exist because when I run [tblevent].[begin_datetime] = '2/5/05' many records return. I have also tried [tblevent].[begin_datetime] = getdate() + 1 which also returns no records. How is the best way to solve this problem. |
#3
| |||
| |||
|
|
It's hard to say for sure without knowing how the data is stored but I would guess it could have something to do with the time portion of your datetime data. Try using the following and see if it works: [tblevent].[begin_datetime] = DateAdd(dd, 1, convert(varchar(10), GetDate(), 101)) -Sue On Fri, 4 Feb 2005 08:27:09 -0800, "seeker53" seeker53 (AT) discussions (DOT) microsoft.com> wrote: I have a datetime field in a SQL SERVER and I need to know clients that are scheduled for the next day when reading the info on the current day. I have tried [tblevent].[begin_datetime] = dateadd(d,1,getdate()) within the where clause and this does not return any records. I know that the records exist because when I run [tblevent].[begin_datetime] = '2/5/05' many records return. I have also tried [tblevent].[begin_datetime] = getdate() + 1 which also returns no records. How is the best way to solve this problem. |
#4
| |||
| |||
|
|
I have a datetime field in a SQL SERVER and I need to know clients that are scheduled for the next day when reading the info on the current day. I have tried [tblevent].[begin_datetime] = dateadd(d,1,getdate()) within the where clause and this does not return any records. I know that the records exist because when I run [tblevent].[begin_datetime] = '2/5/05' many records return. I have also tried [tblevent].[begin_datetime] = getdate() + 1 which also returns no records. How is the best way to solve this problem. |
#5
| |||
| |||
|
|
You are very correct it does have to do with the time part of the field but your suggestion did not pull data either. Any other directions? "Sue Hoegemeier" wrote: It's hard to say for sure without knowing how the data is stored but I would guess it could have something to do with the time portion of your datetime data. Try using the following and see if it works: [tblevent].[begin_datetime] = DateAdd(dd, 1, convert(varchar(10), GetDate(), 101)) -Sue On Fri, 4 Feb 2005 08:27:09 -0800, "seeker53" seeker53 (AT) discussions (DOT) microsoft.com> wrote: I have a datetime field in a SQL SERVER and I need to know clients that are scheduled for the next day when reading the info on the current day. I have tried [tblevent].[begin_datetime] = dateadd(d,1,getdate()) within the where clause and this does not return any records. I know that the records exist because when I run [tblevent].[begin_datetime] = '2/5/05' many records return. I have also tried [tblevent].[begin_datetime] = getdate() + 1 which also returns no records. How is the best way to solve this problem. |
![]() |
| Thread Tools | |
| Display Modes | |
| |