Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

SYSDATE

2 posts in Windows NT Last posting was on 1998-05-13 17:28:24.0Z
Stephanie Matzek Posted on 1998-05-12 09:00:38.0Z
Message-ID: <35580FB6.CF377340@planet.de>
Date: Tue, 12 May 1998 11:00:38 +0200
From: Stephanie Matzek <Stephanie.Matzek@planet.de>
X-Mailer: Mozilla 4.04 [en] (WinNT; I)
MIME-Version: 1.0
Subject: SYSDATE
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.sqlserver.nt
Lines: 9
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.sqlserver.nt:5020
Article PK: 1092389

Hi everybody!
My name is Steffi and I'm learn 'commercial data handling'.
Since some month I work with SQL and PL//SQL for a data base.
Now my question:
I want to compare SYSDATE and a date in a table, but only DD and MON
must be equal. The YYYY changes every time!

Who can help me??
Perhaps in German?

Bye Steffi


Bret Halford Posted on 1998-05-13 17:28:24.0Z
Message-ID: <3559D838.5D40@sybase.com>
Date: Wed, 13 May 1998 11:28:24 -0600
From: Bret Halford <bret@sybase.com>
Organization: Customer Service & Support
X-Mailer: Mozilla 3.0 (X11; U; SunOS 5.5.1 sun4m)
MIME-Version: 1.0
To: Stephanie Matzek <Stephanie.Matzek@planet.de>
Subject: Re: SYSDATE
References: <35580FB6.CF377340@planet.de>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.sqlserver.nt
Lines: 27
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.sqlserver.nt:5014
Article PK: 1092378


Stephanie Matzek wrote:
>
> Hi everybody!
> My name is Steffi and I'm learn 'commercial data handling'.
> Since some month I work with SQL and PL//SQL for a data base.
> Now my question:
> I want to compare SYSDATE and a date in a table, but only DD and MON
> must be equal. The YYYY changes every time!
>
> Who can help me??
> Perhaps in German?
>

something like this?

declare @SYSDATE datetime
select @SYSDATE = getdate()

select * from mytable
where datepart('dd',date_column) = datepart('dd',@SYSDATE)
and datepart('mm',date_column) = datepart('mm',@SYSDATE)

Unfortunately, this will be very ineffecient as SQL Server cannot
use any indexes because of the function use.

If you were going to do this kind of select often, you might create and
index columns "dd" and "mm" using triggers to keep them populated and
up-to-date.
--
Bret Halford Imagine my disappointment
Sybase Technical Support in learning the true nature
3665 Discovery Drive of rec.humor.oracle...
Boulder, CO 80303