Solved

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

Posted on 2004-09-02
5
1,857 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
  • 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
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

809 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