|
Posted by Stephen2 on 07/04/07 15:41
On Jul 4, 3:53 pm, Yas <yas...@gmail.com> wrote:
> Hi,
>
> I am creating creating a table with a Date column dd-mm-yyyy. But I
> cant seem to find a SQL function that just returns today's date.
> getDate() returns the time as well so I cant use it.
>
> The reason is simply that I want to update/overwrite over and over
> again all records from current day but not touch the ones from
> yesterday etc and with the timestamp in there I just end up adding
> more and more rows for the same day.
>
> In other words I only want to preserve rows are from yesterday or
> older but overwrite ones from today.
>
> Any help will be appricated.
>
> Thank you!
>
> Yas
AFAIK a there is no DATE type in MS SQL, only DATETIME so you cannot
store only the date part.
You can use SELECT CONVERT(VARCHAR(8),datevalue,112) to return the
datetime in YYYYMMDD format without the time but it's stored as a
VARCHAR not a DATETIME.
[Back to original message]
|