Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Adding Days to Dates in SQL Server

0 views
Skip to first unread message

Mike Squires

unread,
Aug 22, 2000, 3:00:00 AM8/22/00
to
Is it possible to easily add say 30 days to an existing date in table? In
this case not the system date. I have a record which has the date 01-01-2000
and I want to add 30 to it, so the date is 31-01-2000.

Is this possible in SQL?

Mike Squires

unread,
Aug 22, 2000, 3:00:00 AM8/22/00
to

Thomas R. Hummel

unread,
Aug 22, 2000, 3:00:00 AM8/22/00
to
Check out the DATEADD function in the Transact SQL help file.

-Tom.

In article <96693688...@ernani.logica.co.uk>,


Sent via Deja.com http://www.deja.com/
Before you buy.

markdm...@my-deja.com

unread,
Aug 22, 2000, 3:00:00 AM8/22/00
to
And, even easier than that, because you are dealing with days, you can
do a

[date_column] + 30

and it will add 30 days to it.

In article <8nu7fq$m3c$1...@nnrp1.deja.com>,

BPMargolin

unread,
Aug 22, 2000, 3:00:00 AM8/22/00
to
Though please note that this will work only in SQL Server 7.0. Date arithmetic
does not work in versions of SQL Server before 7.0.

---------------------------------------------------------------
BP Margolin
Please reply only to the newsgroups.
When posting, inclusion of SQL (CREATE TABLE ..., INSERT ..., etc) which can be
cut and pasted into Query Analyzer is appreciated.

<markdm...@my-deja.com> wrote in message news:8nu9nt$p2k$1...@nnrp1.deja.com...

0 new messages