Solved

Convert YYYYMMDD as a Char(8)  to DD/MM/YYYY varchar(10) in SQL 2k

Posted on 2004-09-02
5
1,865 Views
Last Modified: 2007-12-19
I imported a table in which the date format is YYYYMMDD Char(8) and I need to convert the
date to the DD/MM/YYYY varchar(10) format.  Is there an update statement or something
equivalent to make this conversion painless?  Thanks for your help.
0
Comment
Question by:Chuck_aa
[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
  • 3
  • 2
5 Comments
 
LVL 11

Expert Comment

by:ram2098
ID: 11965040
select convert(varchar(20),getdate(),103)

this will give you the date in dd/mm/yyyy format.
0
 
LVL 11

Accepted Solution

by:
ram2098 earned 500 total points
ID: 11965049
sorry..change it to varchar(10)..
select convert(varchar(10),getdate(),103
0
 
LVL 7

Expert Comment

by:FDzjuba
ID: 11965122
SELECT CAST((substring(@cDate,7,2)+'/'+substring(@cDate,5,2)+'/'+ substring(@cDate,1,4)) as nvarchar(10))
0
 
LVL 11

Expert Comment

by:ram2098
ID: 11965133
Replace getdate() below..to the date in your table...

select convert(varchar(10),yourdatefield,103)
0
 
LVL 7

Expert Comment

by:FDzjuba
ID: 11965135
oops, where @cDate is your column name:)
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

695 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