Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

convert date column to mmddyyyy format

Posted on 2008-10-17
2
Medium Priority
?
485 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
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
Viewers will learn how the fundamental information of how to create a table.

721 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