简体   繁体   中英

Importing Data from excel into sql server

I am trying to import data into sql server using ssis packages. I have a column named description and that has a cell having 690 characters.

I am getting a truncation error as SSIS is not able to figure out the maximum length required. I tried changing the output column properties from the excel source connection but that didn't help. However, when I move the cell with the maximum length to the first row it works perfectly (as ssis package determines the max length from the first 8 rows).

Since, I want to automate this process I don't want to modify the excel sheet each and every time. I have read about changing the number of rowsets that ssis reads, but haven't been able to figure out how to do it.

Any type of help would be appreciated.

The answer to the question is that you go to windows registry and change the excel connection manager to see more than 8 rows to determine the column data type and length, which solves the issue.

You go to windows registry by typing "regedit" in the run console and when you are in the windows registry you follow

HKEY_LOCAL_MACHINE -> SOFTWARE -> Wow6432Node -> Microsoft -> Jet -> 4.0 ->Engines -> Excel -> and then set the typeguessrows to 0, so that it can parse through the entire file instead of the top 8 rows.

You need to specify the length of your Excel Source input columns.

In your SSIS Package, right click on the Excel source in the data flow task and click on "Advance Editor for Excel Source". Next change the data type and length of the column from its default value.

If you are using VS2015 or above, right-clic on the Excel Source and clic properties. In the bottom part of the properties clic in the Show Advance Editor link and change the length in the Input and Output Properties tab.

Hope it works for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM