I'm trying to filter rows to a datetime column as it matches to a datetime
column in another table. For example:
For Each irow In dsbnlsum.Tables(0).Select("inv_dt between '" &
(irowd("inv_dt") - 1) & Chr(39) & " and '" & (irowd("inv_dt") + 1) &
Chr(39))
(Developed in vb .net, but a basic question for sql server as well.)
Note that I took a datetime column in a table represented by irowd and
overlapped it, so that my datetime column (inv_dt) would be inside the
range. I'm not even sure this will work, but is there a better way? FYI -
inv_dt is often created as Now, so it could be 8/22/2002 5:16pm or
03/18/2001 12:02am, etc.
Tx for any help.
Bernie YaegerSearch SQL books on line for 'Date and Time Functions' also SQL uses BETWEEN
if you wish to search for a date with a range. eg:-
Select * from table where DateColumn between '20031007 13:27' AND GetDate()
HTH
Ryan Waight, MCDBA, MCSE
"Bernie Yaeger" <berniey@.cherwellinc.com> wrote in message
news:DZygb.60405$E95.31061722@.news4.srv.hcvlny.cv.net...
> I'm trying to filter rows to a datetime column as it matches to a datetime
> column in another table. For example:
> For Each irow In dsbnlsum.Tables(0).Select("inv_dt between '" &
> (irowd("inv_dt") - 1) & Chr(39) & " and '" & (irowd("inv_dt") + 1) &
> Chr(39))
> (Developed in vb .net, but a basic question for sql server as well.)
> Note that I took a datetime column in a table represented by irowd and
> overlapped it, so that my datetime column (inv_dt) would be inside the
> range. I'm not even sure this will work, but is there a better way?
FYI -
> inv_dt is often created as Now, so it could be 8/22/2002 5:16pm or
> 03/18/2001 12:02am, etc.
> Tx for any help.
> Bernie Yaeger
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment