Forum Discussion

Shiny_Felicita's avatar
Shiny_Felicita
Copper Contributor
Sep 14, 2023

Importing excel data in SQL Server

Hi All,

I am using SQL Server 2022 Express Edition(Not a licensed one). I couldn't able to import excel data in SQL Server for Power BI Dashboard. Can someone help me out to resolve this. PFA error images.

 

Thanks,

Shiny

 

 

 

 

  • olafhelper's avatar
    olafhelper
    Sep 15, 2023

    Shiny_Felicita 

    "Text was truncated or one or more characters had no match in the target code page.".


    As I already wrote, source text to long or you try to import Unicode (nvarchar) into a varchar column.

    Check source + target data types & max length.

  • olafhelper's avatar
    olafhelper
    Bronze Contributor

    Shiny_Felicita , next time please post the error message as text, not as a screenshot; it's hard to see anything in that small image.

    I see "truncation" and that means you try to import larger data into a table column then defined by the target column, e.g. 255 characters (default for Excel) into a column of varchar(50); that's not possible.

    So check the data sizes is source and destination.

    • Shiny_Felicita's avatar
      Shiny_Felicita
      Copper Contributor
      Thanks for your suggestion. The below mentioned is the error description of the attached screenshot.

      - Executing (Error)
      Messages
      Error 0xc020901c: Data Flow Task 1: There was an error with Source - Report1690184236624$.Outputs[Excel Source Output].Columns[Resolution] on Source - Report1690184236624$.Outputs[Excel Source Output]. The column status returned was: "Text was truncated or one or more characters had no match in the target code page.".
      (SQL Server Import and Export Wizard)

      Error 0xc020902a: Data Flow Task 1: The "Source - Report1690184236624$.Outputs[Excel Source Output].Columns[Resolution]" failed because truncation occurred, and the truncation row disposition on "Source - Report1690184236624$.Outputs[Excel Source Output].Columns[Resolution]" specifies failure on truncation. A truncation error occurred on the specified object of the specified component.
      (SQL Server Import and Export Wizard)

      Error 0xc0047038: Data Flow Task 1: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on Source - Report1690184236624$ returned error code 0xC020902A. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure.
      (SQL Server Import and Export Wizard)
      • olafhelper's avatar
        olafhelper
        Bronze Contributor

        Shiny_Felicita 

        "Text was truncated or one or more characters had no match in the target code page.".


        As I already wrote, source text to long or you try to import Unicode (nvarchar) into a varchar column.

        Check source + target data types & max length.

  • rmeldrum's avatar
    rmeldrum
    Copper Contributor
    Try increasing the size of the data definition in the previous wizard to max. Generally, it is easier to just set all the column types to VARCHAR(MAX). Then sort the data types out once you have it in a staging table.

Resources