How do I in SQL Server 2005 use the DateAdd function to add a day to a date
相关问题
- SQL join to get the cartesian product of 2 columns
- sql execution latency when assign to a variable
- Difference between Types.INTEGER and Types.NULL in
- What is the best way to cache a table from a (SQL)
- php PDO::FETCH_ASSOC doesnt detect select after ba
Use the following function:
date is the date you want to manipulate
value is the integere value you want to add (or subtract if you provide a negative number)
type is one of:
SELECT DATEADD(dd, 1, GETDATE()) will return a current date + 1 day
http://msdn.microsoft.com/en-us/library/ms186819.aspx
Try following code will Add one day to current date
And in the same way can use Year, Month, Hour, Second etc. instead of day in the same function
The following query i have used in sql-server 2008, it may be help you.
*20 is the day quantity