It doesn't work for FORMAT in ms sql



  • Hello, studying t-sql. It reached the section where the formatted date is used. On one of the official Microsoft sites https://msdn.microsoft.com/ru-ru/library/hh213505.aspx described how to use a function FORMAT()

    He wrote such a request:

    DECLARE @d DATETIME = '10/01/2011';  
    SELECT FORMAT ( @d, 'd', 'en-US' ) AS 'US English Result';
    

    But in this violin, there's a mistake:

    _ FORMAT is not a known name for a built-in function."

    Tell me what's going on. Using MS SQL 2008R2, Windows7.



  • as the Bald user wrote https://msdn.microsoft.com/ru-ru/library/hh213505.aspx available from version SQL SERVER 2012

    In the early days, you can use this:

    DECLARE @d DATETIME = '10/01/2011';
    SELECT CONVERT(VARCHAR(12) , @d , 3)
    

    Result:

    01/10/11
    

    http://www.sql-server-helper.com/sql-server-2008/sql-server-2008-date-format.aspx


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2