0

I am working on SQL server 2005. While inserting specified date in the database by this format:
(10/11/2012 00:00:0:00)(MM/dd/yyyy HH:mm:s:ms).

select CAST(day(column name) AS CHAR(2)) + ' '
   + CONVERT(CHAR(4), column name, 100) + ', '
   + CONVERT(CHAR(4), column name, 120) as Coupon_expire
from Admin

I can't convert this date to this type (Wednesday, October 11, 2012), please help me.

0

1 Answer 1

1
SELECT  DATENAME(weekday,'10/11/2012')
      + ', '
      + DATENAME(month,'10/11/2012')
      + ' '
      + convert(varchar,month('10/11/2012'))
      + ', '
      + convert(varchar,year('10/11/2012'))    

Try this.

1
  • +1 for a good solution, one minor detail. In my opinion, instead of using default length, you should always specify the length of the varchar. Oct 26, 2012 at 7:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.