Convert Date format in a table

58 Views Asked by At

I am trying to convert the date format of a column to (MM/DD/YYYY) but it doesn't work

ALTER TABLE dbo.DimDate 
ADD FormattedFullDateAlternateKey date;

UPDATE dbo.DimDate
SET FormattedFullDateAlternateKey = CONVERT(varchar, FullDateAlternateKey, 101);

It actually works when I just do a select:

SELECT CONVERT(varchar, FullDateAlternateKey, 101) AS FullDateAlternateKey
FROM dbo.DimDate;

I want to store the new column with the new date format in my database, but I couldn't, any help please

0

There are 0 best solutions below