I want to add 1 year to a datetime-type column in every single row in a table. Adding using an UPDATE statement is easy for numeric types. ex:
UPDATE TABLE SET NUMBERCOLUMN = NUMBERCOLUMN + 1
I'd like to do the same thing with a DATETIME-type...
UPDATE Procrastination SET DropDeadDueDate = DropDeadDueDate + ?
...but I'm not sure what value to use. Is there a numeric value I could use that means "1 year"? Or is there a DATEADD function or similar in SQL Server?
ADDITIONAL QUESTION
I would like to do this for not one field, but for every field in the database of data type 'datetime'. Is there an easy way to select all fields of type 'datetime' and perform an update of adding x amount of years? I am new to sql so please be gentle...
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…