patternsqlMinor
SSIS keeps force changing excel source string to float
Viewed 0 times
keepsforceexcelsourcefloatssischangingstring
Problem
There is a column in Excel that is supposed to be text, but SSIS sees numeric text there and automatically makes it double-precision float [DT_R8].
I can change it manually in the Output branch's External and Output columns, but the Error Output simply refuses to let me change the respective column.
I have tried modifying the package xml. I tried the
The excel field to be imported into the SQL nvarchar field reads for example
but they are being written to the SQL table as
I put in dataviewers and the fields show
all the way thru execution which is correct but I guess when it hits the OLE DB Destination source it somehow converts it to the
which is wrong.
I also have values such as V321.1 and V213.34 for example which are definitively not integers and need to be stored as varchar.
I can change it manually in the Output branch's External and Output columns, but the Error Output simply refuses to let me change the respective column.
Error at Extract Stations [Excel Source [1]]: The data type for "output "Excel Source Error Output" (10)" cannot be modified in the error "output column "Group No" (29)".
Error at Extract Stations [Excel Source [1]]: Failed to set property "DataType" on "output column "Group No" (29)".I have tried modifying the package xml. I tried the
IMEX=1 and typeguessrow=0 but none of that has fixed my problem. Does this have any fix at all? There are also articles suggesting you modify your registry so that excel reads more then the default 8 rows before guessing the data type. I do not want to go this route because even if it were to work, then I would have to modify the registry on the machine I plan to run the package on.The excel field to be imported into the SQL nvarchar field reads for example
295.3
296.33but they are being written to the SQL table as
295.30000000000001
296.32999999999998I put in dataviewers and the fields show
295.3
296.33all the way thru execution which is correct but I guess when it hits the OLE DB Destination source it somehow converts it to the
295.30000000000001
296.32999999999998which is wrong.
I also have values such as V321.1 and V213.34 for example which are definitively not integers and need to be stored as varchar.
Solution
Step 1: Add
Step 2: Close the solution. Open the SSIS package in text editor, find the columns that kept reversing back to the pre defined data type. Update it manually in the XML file to the desired format.
Step 3: Open up the package in SQL Server Data Tool and execute, now you should be able to load the data as it is from the file.
IMEX=1; MAXROWSTOSCAN=0 in the connections string (e.g. Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Source\filename.xlsx;Extended Properties="EXCEL 12.0 XML;HDR=YES;IMEX=1; MAXROWSTOSCAN=0").Step 2: Close the solution. Open the SSIS package in text editor, find the columns that kept reversing back to the pre defined data type. Update it manually in the XML file to the desired format.
Step 3: Open up the package in SQL Server Data Tool and execute, now you should be able to load the data as it is from the file.
Context
StackExchange Database Administrators Q#39252, answer score: 3
Revisions (0)
No revisions yet.