About 52 results
Open links in new tab
  1. SQL DATEPART(dw,date) need monday = 1 and sunday = 7

    Jul 22, 2014 · DATEPART(dw,ads.date) as weekday I need the result so: Sunday = 7 Monday = 1 etc. Is there any shortcut to do this? Or I will have to do a CASE statement?

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

    Sep 22, 2008 · If I can get on my soapbox for a second, this kind of formatting doesn't belong in the data tier, and that's why it wasn't possible without silly high-overhead 'tricks' until SQL Server 2008 when …

  3. how to use datepart with date in sql server - Stack Overflow

    Apr 24, 2018 · I am working on an sql query where i want to attach datepart with time part. in the time part minute will be 20,40,59. and second will be always 00. For this i used the following query: …

  4. Getting only Month and Year from SQL DATE - Stack Overflow

    Nov 23, 2009 · I need to access only Month.Year from Date field in SQL Server.

  5. How do I get the month and day with leading 0's in SQL? (e.g. 9 => 09)

    Dec 10, 2012 · SELECT RIGHT(REPLICATE('0', 2) + CAST(DATEPART(DAY, '2012-12-09') AS varchar(2)), 2) AS leftpadded_day Go native The CONVERT function offers various methods for …

  6. sql - Get Hours and Minutes (HH:MM) from date - Stack Overflow

    Jan 17, 2013 · I want to get only hh:mm from date. How I can get this? I have tried this : CONVERT(VARCHAR(8), getdate(), 108)

  7. sql server - SQL Get "ISO Year" for ISO Week - Stack Overflow

    Mar 16, 2017 · CASE WHEN DATEPART(ISO_WEEK, @Date) > 50 AND MONTH(@Date) = 1 THEN YEAR(@Date) - 1 WHEN DATEPART(ISO_WEEK, @Date) = 1 AND MONTH(@Date) = 12 THEN …

  8. Time part of a DateTime Field in SQL - Stack Overflow

    Sep 10, 2012 · How would I be able to extract the time part of a DateTime field in SQL? For my project I have to return data that has a timestamp of 5pm of a DateTime field no matter what the date is

  9. sql - Get 2 Digit Number For The Month - Stack Overflow

    Feb 20, 2013 · 82 I have an integer column "Month" I would like to get 2 digit number for month. This is what I have tried: DATEPART (mm, @Date) It returns one digit for months January to September I …

  10. Get dates from a week number in T-SQL - Stack Overflow

    In Microsoft SQL Server, I have a week number (from DATEPART(wk, datecol)) But what I would like to do is turn this back into the date span for that week. For example, SELECT DATEPART(wk, GET...