About 50 results
Open links in new tab
  1. sql server - How to add days to the current date? - Stack Overflow

    Select (Getdate()+360) As MyDate There is no need to use dateadd function for adding or subtracting days from a given date. For adding years, months, hours you need the dateadd function.

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

    SELECT FieldOne, DateField FROM Table WHERE (DateField> DATEADD(day, @days, GETDATE())) Where @days = -10 Any ideas into what I am doing wrong? Incidentally I am setting this variable in …

  3. sql - How can I use a column's values for DATEADD ()'s datepart ...

    Nov 9, 2023 · 0 This question already has answers here: send datepart as parameter from a table to DATEADD function in sql server (2 answers)

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

  5. SQL query not working with function DateAdd - Stack Overflow

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

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

    Apr 14, 2016 · From the DATEADD documentation: If datepart is month and the date month has more days than the return month and the date day does not exist in the return month, the last day of the …

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

    Apr 27, 2018 · SELECT (DATEADD(hour,-5,arrival)) FROM( SELECT CONVERT(VARCHAR(8), arrival)) FROM locations )a 4-6-2018 12:35:43 This query will give readd the date. How can I remove …

  8. sql server - SQL dateadd function for last month doesn't work? - Stack ...

    Aug 1, 2024 · It is worth noting that the above answer uses a half-open interval for the date/time range, where the month-end is defined as 00:00 on the first day of the following month, and the comparison …

  9. sql - DATEADD function not working as expected in CASE expression ...

    Jun 20, 2023 · I'm trying to build a SQL statement for use in a PowerBI report, that gets the number of times each listed operator performed one of three functions (referred to here as creation …

  10. sql server - How can I select the first day of a month in SQL? - Stack ...

    I used GETDATE () as a date to work with, you can replace it with the date which you need. Here's how this works: First we format the date in YYYYMMDD... format truncating to keep just the 6 leftmost …