Excel Source DT_NTEXT Problem

  • i am trying to load the data from excel files and facing problem in Text data.

    Excel source in SSIS tries to pull data as STRING as the first few rows contain lesser text.

    Is there a way to make it think that the data is of type Unicode TEXT stream?

    Or can any one send me some other solution like using a script component to pull data from EXCEL.

    i am stuck with this for last two days and need to finish it by today.

    Please help me out of this?

    Thanks

  • SSIS always treat the Excel Source data as unicode. This is a issue which is very common when you are reading from Excel file. You have to read the data and then convert it to type(string, unicode) you desire to use. There are a lot of articles on internet which address this issue. You can find out on SQLServerCenteral.com or you can refer the below link.

    SSIS: 3 Ways to resolve Unicode and non-unicode data type issue?

    Vikash Kumar Singh || www.singhvikash.in

  • When you read data from Excel using SSIS, the OLEDB provider reads the first few rows of the worksheet and tries to guess what the data type is for each column based on the contents of these rows. So, if in the those rows, it only sees data that would fit into a "STRING", then this is the data type it uses. If it happens that there is a cell with a lot of data in it, then the provider may guess that the data type should be "NTEXT". The same sort of logic applies for numeric fields and (I think) dates.

    You can't change this behaviour but you can change the number of rows that the OLEDB provider reads in order to make that guess. This value is stored in the registry. Try searching the registry on your machine for "TypeGuessRows" - you will find at least 2 instances of it for Excel (in a key something like HKLM\Software\Microsoft\Office\15.0\Access Connectivity Engine\Engines\Excel). By default the value is 8 which means that the OLEDB Provider will search the first 8 rows of the spreadsheet and use the values in those rows when it tries to guess the data type. If you increase this value, it will use more rows to do its guess.

    This may not work for you all the time - that really depends on the nature of the data you are importing and whether the data that truly represents your data type is in those rows, but it is the only way I know to influence the choice of data type.

    This process occurs whenever the spreadsheet is opened by the OLEDB provider i.e. every time the SSIS package runs. You will need to make the same registry change wherever the package will be executing.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply