AW: simple SQL query question

Peter A. Sang ( (no email) )
Mon, 24 Mar 1997 17:11:41 +0100

Josh,
a SELECT out of my bio-memory :)

DECLARE @startdate char(20)
SELECT @startdate =3D 'Mar 17 1997 12:00AM'
DECLARE @enddate char(20)
SELECT @startdate =3D 'Mar 24 1997 12:00AM'
[...]
>select somecolumns
>from sometable
>where date > @startdate
>and date < @enddate

_should_ do the job....

Hope it helps!

cu, Peter

-
Peter A. Sang
SANG Computersysteme GmbH * Kruppstr. 82-100 * 45145 Essen * Germany
T: +49-201-82020-0 * F:-40 * http://sang.net * mailto:pesa@sang.net
* Microsoft Solution Provider * Intel Systems Integrator *

>----------
>Von: Josh Hillman[SMTP:admin-maillist@talstar.com]
>Gesendet: Montag, 24. M=E4rz 1997 16:44
>An: ntisp@emerald.iea.com
>Betreff: simple SQL query question
>
>When executing a SQL query that has many mentions of the same =
dates/times
>throughout it, can that date be replaced by "variable"? In other words
>something like this:
>
>startdate =3D "Mar 17 1997 12:00AM"
>enddate =3D "Mar 24 1997 12:00AM"
>
>select somecolumns
>from sometable
>where date > startdate
>and date < enddate
>
>select someothercolumns
>from someothertable
>where date > startdate
>and date < enddate
>
>
>
>This is no big deal if the dates are only mentioned once, but if the =
same
>ones are all over the place and the dates need to be adjusted from week =
to
>week, redoing all the dates can drive me crazy...
>
>Thanks for any insight,
>
>Josh Hillman
>hillman@talstar.com
>
>
>
> ----------------------------------------------------------
> NTISP Mailing List listserver@emerald.iea.com
>
>