Null values in dates - unable to read from ssis

Shambhu Rai 1,411 Reputation points
2022-03-30T19:40:42.047+00:00

Hi Expert,

I am importing dates from excel to SSIS to load data but some values are null in dates so ssis unable to read it as date and reading as nchar

188514-image.png

SSIS reading as number or nchar
188488-image.png

have another date dimension where there is no null data and reading properly

expected results as below.Please suggest . I heard about ime=1 but do not know how to import it

188498-image.png

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,924 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,578 questions
SQL Server Analysis Services
SQL Server Analysis Services
A Microsoft online analytical data engine used in decision support and business analytics, providing the analytical data for business reports and client applications such as Power BI, Excel, Reporting Services reports, and other data visualization tools.
1,284 questions
0 comments No comments
{count} votes

7 answers

Sort by: Most helpful
  1. Michael Taylor 54,321 Reputation points
    2022-03-30T20:28:32.777+00:00

    There is no such thing as a NULL cell in Excel. An empty cell in Excel is simply an empty string. Excel doesn't actually understand types at all. Everything is a string. What you're referring to as a "type" in Excel is just the formatting that is applied to a column/cell for display purposes and has no bearing on the actual string value. When SSIS imports the data is sees everything as strings. To make the import a little easier it tries to figure out what the actual type is by heuristics. If it cannot figure it out then it just assumes string. Based upon this document it currently uses the first 8 rows. If you have mismatched data then it won't be able to figure things out. Therefore the recommendation is to modify the Extended Properties to include IMEX=1 which tells the provider not to bother and everything gets imported as a string. You would then add a data transformation step to convert the textual values to the actual types you need using the standard SSIS tools. It is at this point you'd also be able to do conditional things like change empty text values to a default value if you wanted.

    0 comments No comments

  2. Shambhu Rai 1,411 Reputation points
    2022-03-30T20:51:32.803+00:00

    can not find this option in ssis
    Extended Properties to include IMEX=1


  3. Shambhu Rai 1,411 Reputation points
    2022-03-30T21:15:40.567+00:00

    ALSO tried this syntax in connectionstring
    " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Source1.xlsx;Extended Properties="EXCEL 12 HDR=YES;IMEX = 1 ;MAXSCANROWS = 15;READONLY = FALSE";"


  4. Shambhu Rai 1,411 Reputation points
    2022-03-30T21:45:54.047+00:00

    added

    Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\Source1.xlsx;Extended Properties="EXCEL 12.0 XML;HDR=YES;IMEX=1";

    again error
    188562-image.png


  5. Shambhu Rai 1,411 Reputation points
    2022-03-30T22:23:09.537+00:00

    I have changed the format in excel sheet to date and it works... getting error in converting nWSTR TO Integer gives as error using data conversion function

    while converting column "No 1" (38) to column "Copy of P#O No 1" (6). The conversion returned status value 2 and status text


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.