I have a requirement to store data in a column in SQL Server with mm/dd/yyyy format. Which in my mind I would create this column with DATE
datatype and use CONVERT()
to convert it in mm/dd/yyyy format
CREATE TABLE [dbo].TempDate
(
CompanyID nvarchar (512) NULL,
VacDate date NULL,
OffDate date NULL,
Duration time NULL
)
SELECT CONVERT(varchar(10), VacDate, 10) AS "StartDate"
FROM [dbo].TempDate;
No issues, I get the date in mm/dd/yyyy format. The problem is that I need to then import this table to CSV format and the date in the table is in its standard yyyy-mm-dd and so that's what gets imported in CSV. I need the date in CSV to be in mm/dd/yyyy format. I tried to INSERT
into this table with CONVERT
, but the date doesn't convert. Is there a way to STORE DATE in mm/dd/yyyy column right out of the gate? Like in Oracle its possible to define the column in a certain format.
Thank you for any thoughts on this.