Thanks for the response but this still does not work. I know how to get the
system date adjusted to meet my criteria by either using DATADD or just
getdate() - some number. I have to find a way to compare JUST the date
portion to JUST the date portion of the transaction date stored in the table.
--
Stan Gosselin
[quoted text, click to view] "Sreejith G" wrote:
> Hi,
>
> Use DATEADD function...
>
> SELECT DATEADD(hh, -3, getdate())
>
> Thanks,
> Sree
>
>
> "Stan" wrote:
>
> > I thought this was simple but...
> > I have a table with a transdate of data type datetime and I want to select
> > all transactions either for today or for getdate() minus some value. Looks
> > to me like the time portion is getting in the way of "where transdate =
> > (getdate() - 3)". How do I deal with just the date portions of these fields?
> > Thanks
> > --
[quoted text, click to view] On Mon, 6 Feb 2006 06:52:43 -0800, Stan wrote:
>I thought this was simple but...
>I have a table with a transdate of data type datetime and I want to select
>all transactions either for today or for getdate() minus some value. Looks
>to me like the time portion is getting in the way of "where transdate =
>(getdate() - 3)". How do I deal with just the date portions of these fields?
>Thanks
Hi Stan,
To remove the time portion from a datetime column (or variable), use
SELECT DATEADD(day, DATEDIFF(day, 0, CURRENT_TIMESTAMP), 0)
--
Hugo,
This does the trick! Thanks so much for the response to this and the other
post I made.
Have a good day and thanks again for the help.
--
Stan Gosselin
[quoted text, click to view] "Hugo Kornelis" wrote:
> On Mon, 6 Feb 2006 06:52:43 -0800, Stan wrote:
>
> >I thought this was simple but...
> >I have a table with a transdate of data type datetime and I want to select
> >all transactions either for today or for getdate() minus some value. Looks
> >to me like the time portion is getting in the way of "where transdate =
> >(getdate() - 3)". How do I deal with just the date portions of these fields?
> >Thanks
>
> Hi Stan,
>
> To remove the time portion from a datetime column (or variable), use
>
> SELECT DATEADD(day, DATEDIFF(day, 0, CURRENT_TIMESTAMP), 0)
>
>
> --
> Hugo Kornelis, SQL Server MVP
Don't see what you're looking for? Try a search.