Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Posts
    8

    Unanswered: Convert smalldatetime to mmm yy format in query

    I am trying to write a simple query that retrieves the data field from a table (stored in the smalldatetime format) and converts the date to mmm yy format. The closest I can get is retrieving the date in the dd mmm yy format using the query below.

    select convert(varchar(10),DATA_DATE,06) As DATA_DATE

    If there an easy way to parse out the information I want? I also attempted to use the SUBSTR functions, but they always returned error messages.

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    So you want to exclude the dd out of the datetime ?

  3. #3
    Join Date
    Feb 2002
    Posts
    2,232
    Try the following:


    select right(convert(varchar(20),getdate(),06), len(convert(varchar(20),getdate(),06)) -3)

  4. #4
    Join Date
    Jan 2004
    Posts
    8

    Talking Perfect

    That is exactly what I have been attempting to do. Thank you for your help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •