About 213,000 results
Open links in new tab
  1. sql server - SQL Subtract exactly a year - Stack Overflow

    Aug 4, 2014 · You could also take it a bit further and implement a table valued function that will return a two column result year offset 2010 0 --Produced from DATEPART(y,GETDATE()) …

  2. sql server - SQL query not working with function DateAdd - Stack …

    Dec 22, 2021 · select DATEADD (day,-1,cast (getdate () as date)) as yesterday from dual; I am using this query for subtracting one day from date but this is showing invalid identifier in my sql …

  3. How to add hours to current date in SQL Server? - Stack Overflow

    Aug 29, 2013 · The DATEADD () function adds or subtracts a specified time interval from a date. DATEADD(datepart,number,date) datepart (interval) can be hour, second, day, year, quarter, …

  4. How to return only the Date from a SQL Server DateTime datatype

    Sep 22, 2008 · NOTE: This answer returns the original DATETIME or DATETIME2 type. For an expression that returns a true DATE type (SQL Server 2008 and later), see BenR's answer …

  5. sql server - Using Parameters in DATEADD function of a Query

    The following code works perfectly fine here (SQL Server 2005, executed in Management Studio): DECLARE @days decimal SET @days = -10 SELECT DATEADD(day, @days, GETDATE())

  6. sql - Is there a way to use the dateadd () in the where clause in a ...

    Nov 6, 2015 · Here's my problem. In my where clause I am trying to use the between clause with dates. In the second date I add, I need it to return the day after the date that is being input. For …

  7. How do I convert a value after using DATEADD with it

    Apr 27, 2018 · Probably this is what you are asking for: SELECT Convert(Varchar(8), DATEADD(hour,-5,arrival), 108) FROM locations; Note: This is compatible with SQL server …

  8. sql server - How to add days to the current date? - Stack Overflow

    I am trying to add days to the current date and it's working fine but when I add 360 days to the current date it gives me wrong value. eg: Current Date is 11/04/2014 And I am adding 360 …

  9. sql server - DATEADD issue when negative number is used with …

    Apr 14, 2016 · 0 simple workflow for dateadd function ie. for Day -it's add day (next valid day) for week -it's add week (next 7 days) for month -it's add month (next month only and fill forward if …

  10. sql server - Get the last day of the month in SQL - Stack Overflow

    This works by taking the number of months that have passed since the initial date in SQL's date system (1/1/1990), then adding that number of months to the date "-1" (12/31/1899) using the …