Reputation: 628
I have a nvarchar(50)
column in SQL which is of format mm/dd/yyyy
. I am trying to import this data in excel using SSIS. In ssis package, I am creating a column Date_1 with datatype Date in Execute SQL task (Since .xlsx file needs to be created dynamically) and in my data flow task I am converting Date_1 to date(DT_DATE
). But after data migration when I check my file column Date_1 is of General data type and not Date. Can someone help me how to convert General column to Date
Upvotes: 1
Views: 905
Reputation: 37313
The drop down list you are showing in the Microsoft Excel interface is not related to the data type it is the Number Format
property which is used to change the way the value is shown in Excel.
To change this property you need to use Microsoft.Interop.Excel
library within a Script Task and change the Excel.Range.NumberFormat
property. As example:
Range rg = (Excel.Range)xlWorksheet.Cells[1,1];
rg.EntireColumn.NumberFormat = "MM/dd/yyyy";
References
Upvotes: 1