Home » excel » sql server – import date column from excel into SSIS – getting long date format in SQL

sql server – import date column from excel into SSIS – getting long date format in SQL

Posted by: admin April 23, 2020 Leave a comment

Questions:

I am trying to import a CSV file into SQL server using SSIS. There is a date column (formatted as date when file is opened in excel). Column is DT_DBDATE in Flat file manager. I am trying to load this data into a SQL server date column. The data is formatted as 1/17/2016. I can see in data viewer that the data stays in this format from flat file source to OLE DB Destination but when the data is finally loaded into SQL table the format is changed to 1/17/2016 12:00:00 am. How do I get the data to stay as 1/17/2016 in my final destination of SQL server?

How to&Answers:

It depends on the destination column data type:

  • If the column data type is datetime or smalldatetimethen the time will be displayed.
  • If the column data type is date (SQL Server 2012+) then time will not be displayed

For more info you can refer to the following link:

So if you don’t need the time part you can change the destination column type to Date, or you can just remove the time part when reading the values within an application or a report.

<a href="https://exceptionshub.com/category/sql-server”>More Answers>