Chuck_aa
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SELECT CAST((substring(@cDate,7,2 )+'/'+subs tring(@cDa te,5,2)+'/ '+ substring(@cDate,1,4)) as nvarchar(10))
Replace getdate() below..to the date in your table...
select convert(varchar(10),yourda tefield,10 3)
select convert(varchar(10),yourda
oops, where @cDate is your column name:)
this will give you the date in dd/mm/yyyy format.