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 S
There is in fact a DATEADD statement in T-SQL, you can find it here
UPDATE Procrastination SET DropDeadDueDate = DATEADD(yyyy,1,DropDeadDueDate)
EDIT: You could use year, yy, or yyyy for the first argument of DATEADD.
UPDATE Procrastination SET DropDeadDueDate =
DATEADD(yy, 1, DropDeadDueDate)
ref: http://doc.ddart.net/mssql/sql70/da-db_5.htm
UPDATE Procrastination SET DropDeadDueDate = DATEADD(year, 1, DropDeadDueDate)
http://msdn.microsoft.com/en-us/library/ms186819.aspx
SQL Server has a DATEADD function.
http://msdn.microsoft.com/en-us/library/aa258267(SQL.80).aspx
The DateAdd function should do what you want.
UPDATE Procrastination SET DropDeadDueDate = DateAdd(yy, 1, DropDeadDueDate)
It could be done with a DATEADD() function like this:
UPDATE Procrastination SET DropDeadDueDate = DATEADD(yy, 1, DropDeadDueDate)