Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

convert date column to mmddyyyy format

Posted on 2008-10-17
2
Medium Priority
?
489 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 500 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

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

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

It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

927 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