Link to home
Start Free TrialLog in
Avatar of Chuck_aa
Chuck_aaFlag for United States of America

asked on

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

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.
Avatar of ram2098
ram2098

select convert(varchar(20),getdate(),103)

this will give you the date in dd/mm/yyyy format.
ASKER CERTIFIED SOLUTION
Avatar of ram2098
ram2098

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SELECT CAST((substring(@cDate,7,2)+'/'+substring(@cDate,5,2)+'/'+ substring(@cDate,1,4)) as nvarchar(10))
Replace getdate() below..to the date in your table...

select convert(varchar(10),yourdatefield,103)
oops, where @cDate is your column name:)