Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Trininole
Yak Posting Veteran
83 Posts |
Posted - 2013-08-06 : 11:01:53
|
What is the syntax for adding a column where you are adding a year to a date in a date format? For example adding a column displaying a year after the participation date in date format? Can someone help me with this?Roger DeFour |
|
MuMu88
Aged Yak Warrior
549 Posts |
Posted - 2013-08-06 : 11:11:12
|
Not sure what you are looking for:Is it:[CODE]-- add an year SELECT dateadd(YY, 1, getdate()) AS DATE_ADDYEAR, getdate();-- get year part: SELECT DATEPART(YY, getdate()) AS YEAR_PART , getdate();[/CODE]If this is not what you want, please show some example data. |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-08-07 : 01:01:37
|
do you mean this?ALTER TABLE TableName ADD NewColumnName AS DATEADD(yy,1,ParticipationDate) this will add a new column to table with value as 1 year ahead of ParticipationDate field------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
 |
|
|
|
|