dbTalk Databases Forums  

Adding 1 Month to Date Calculation Column

microsoft.public.sqlserver.server microsoft.public.sqlserver.server


Discuss Adding 1 Month to Date Calculation Column in the microsoft.public.sqlserver.server forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Cory Jones
 
Posts: n/a

Default Adding 1 Month to Date Calculation Column - 01-27-2012 , 12:25 AM






Hi

I'm trying create a calculated column to add 1 month to a date from another column.


CREATE TABLE [dbo].[test_table_date](
[date1] [datetime] NOT NULL,
[date2] AS ([date1]+ ???)
) ON [PRIMARY]

I have tried a couple of things with no luck.Please note that I am a complete novice to TSQL. Hope someone can help.

Cheers
Cory

Reply With Quote
  #2  
Old   
Jeroen Mostert
 
Posts: n/a

Default Re: Adding 1 Month to Date Calculation Column - 01-27-2012 , 01:25 AM






On 2012-01-27 07:25, Cory Jones wrote:
Quote:
I'm trying create a calculated column to add 1 month to a date from another column.


CREATE TABLE [dbo].[test_table_date](
[date1] [datetime] NOT NULL,
[date2] AS ([date1]+ ???)
) ON [PRIMARY]

I have tried a couple of things with no luck.Please note that I am a complete novice to TSQL. Hope someone can help.

....AS DATEADD(MONTH, 1, [date1])

--
J.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.