Need help with convert

  • Hello everyone, when I run this statement:

    select convert(char, '2004-12-22 11:36:02.000', 101)

    I expect to get "12/22/2004", but I get "2004-12-22 11:36:02.000". What am I doing wrong?

    Thanks in advance.

  • You're passing only a string value to convert - you need to first change it to datetime type...try this:

    select convert(char(10), cast('2004-12-22 11:36:02.000' as datetime), 101)







    **ASCII stupid question, get a stupid ANSI !!!**

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply