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.

Sign up to request clarification or add additional context in comments.

1 Comment

+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.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.