add +- 1 year in SQL Server
You are adding the 1 to getdate() so you are adding 1 day
SELECT ProductName FROM tblProduct WHERE Year BETWEEN
(year(getdate()) -1) AND (year(getdate()) + 1)
How can I use a SQL UPDATE statement to add 1 year to a DATETIME column?
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.
Need to find out the date 1 year and 1 year ago from today in SQL
You can also do it like this:
select dateadd(year,-1,dateadd(dd,-1,getdate()))
Related Topics
Sql - How to Get The Unique Key's Column Name from Table
Iterate Through a List of Strings in SQL Server
How to Avoid SQL Query Timeout
Cycle Detection with Recursive Subquery Factoring
Order by Month and Year in SQL with Sum
Convert Datetime to Unix Timestamp
Query SQL Server Database from Native iOS Application
Joining Two Separate Queries in a Postgresql ...Query... (Possible or Not Possible)
Sql Server 2008 - Case/If Statements in Select Clause
How to Identify Views with Broken Dependencies in SQL Server
Running a SQLite3 Script from Command Line
Copy Data from One Existing Row to Another Existing Row in SQL
Are There Any Limits on Length of String in MySQL
Select Statement in Sqlite Recognizing Row Number