locked
how can I change sqlserver datee formate RRS feed

  • Question

  • I have a filed which datatipe is smalldatetime Whein I insert data its shoing date formate like 20010-12-05  But I Need like this dd-mm-yy How can I change this format

    Regards 

    Suman

    Wednesday, October 13, 2010 12:23 PM

Answers

  • Its not storing in format which you are seeing.

    String literal formats affect the presentation of data in applications to users but not the underlying integer storage format in SQL Server. You need to use convert function to get the format you want.


    Balmukund Lakhani | Please mark solved if I've answered your question
    --------------------------------------------------------------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
    --------------------------------------------------------------------------------
    My Blog: http://blogs.msdn.com/blakhani
    Team Blog: http://blogs.msdn.com/sqlserverfaq
    • Marked as answer by Sumanfbc Sunday, October 17, 2010 4:03 AM
    Wednesday, October 13, 2010 12:48 PM
  • Hi

    SQL Server 'understands' YYYYMMDD format when you work with dates. Displaying is matter of the client application , so please take a look at CONVERT system function that has style third parameters

    http://www.karaszi.com/SQLServer/info_datetime.asp


    Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
    • Marked as answer by Sumanfbc Sunday, October 17, 2010 4:04 AM
    Thursday, October 14, 2010 6:21 AM

All replies

  • Take a look at CAST & CONVERT in BOL: http://msdn.microsoft.com/en-us/library/ms187928.aspx

    Tom


    Tom Van Zele | Blog | Twitter | LinkedIn
    Wednesday, October 13, 2010 12:42 PM
  • Its not storing in format which you are seeing.

    String literal formats affect the presentation of data in applications to users but not the underlying integer storage format in SQL Server. You need to use convert function to get the format you want.


    Balmukund Lakhani | Please mark solved if I've answered your question
    --------------------------------------------------------------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
    --------------------------------------------------------------------------------
    My Blog: http://blogs.msdn.com/blakhani
    Team Blog: http://blogs.msdn.com/sqlserverfaq
    • Marked as answer by Sumanfbc Sunday, October 17, 2010 4:03 AM
    Wednesday, October 13, 2010 12:48 PM
  • Hi

    SQL Server 'understands' YYYYMMDD format when you work with dates. Displaying is matter of the client application , so please take a look at CONVERT system function that has style third parameters

    http://www.karaszi.com/SQLServer/info_datetime.asp


    Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
    • Marked as answer by Sumanfbc Sunday, October 17, 2010 4:04 AM
    Thursday, October 14, 2010 6:21 AM
  • Thank you for you answer

    Regards

    Suman

    Sunday, October 17, 2010 4:04 AM

  • Thank you for you answer

    Regards

    Suman

    Sunday, October 17, 2010 4:05 AM