About 205,000 results
Open links in new tab
  1. sql server - Pass Interval parameter to Function in SQL - Stack …

    Nov 29, 2010 · Below is a function that encapsulates my problem. Consider: CREATE FUNCTION [dbo].[DateAdder] (@DateStart datetime, @increment int, @interval ?????) …

  2. 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())

  3. sql server - How can I use a SQL UPDATE statement to add 1 year …

    Aug 16, 2013 · 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 …

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

    Sep 22, 2008 · I recommend changing the answer to SELECT DATEADD(dd, DATEDIFF(dd, 0, @your_date), 0) because then dd can be swapped out for any other datepart keyword to …

  5. sql server - SQL Subtract exactly a year - Stack Overflow

    Aug 4, 2014 · I want the user to input a date, then get the current year. subtract the two and then do the dateadd that everyone was posting. Is this possible and what is the best way to do it?

  6. 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 …

  7. 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 …

  8. sql - Issue with DATEADD Function - Stack Overflow

    Jan 6, 2017 · I have huge calculations happening in SQL based on the dates and years. When I add months to a date its not adding based on the days, its primarily adding 3 months (thats the …

  9. Get the records of last month in SQL server - Stack Overflow

    Sep 15, 2009 · With SQL Server 2022 and later, the DATETRUNC() function can be used to simplify the calculation. The resulting code would be DECLARE @startOfCurrentMonth …

  10. sql server - The datepart hour is not supported by date function ...

    Mar 29, 2017 · The datepart hour is not supported by date function dateadd for data type date Asked 12 years, 8 months ago Modified 8 years, 7 months ago Viewed 37k times