Solved

convert date column to mmddyyyy format

Posted on 2008-10-17
2
479 Views
Last Modified: 2012-05-05
Trying to convert a date column so that output is in the form of mmddyyyy.

I am doing :
rtrim(convert(char,datepart(mm,Citations.dob)))+
rtrim(convert(char,datepart(dd,Citations.dob)))+
rtrim(convert(char,datepart(year,Citations.dob)))

However output is 912008 - it is getting rid of the leading zero in the month and day
0
Comment
Question by:jbeckstrom
2 Comments
 
LVL 60

Accepted Solution

by:
chapmandew earned 125 total points
ID: 22740560
select replace(convert(varchar(10), datefield, 101), '/', '')
0
 

Author Closing Comment

by:jbeckstrom
ID: 31507114
That did it.  Thanks.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now