SSIS Import Excel to SQL Truncation Issues
up vote
0
down vote
favorite
I'm using SSIS 2012 and SQL Server 2014. I've had this issue forever and have YET to see a viable solution - and I'm not sure why more people don't experience this issue. Here is my simple data flow task:
I receive numerous Excel files from clients. The problem is that some of the fields contain text that is greater than 255 characters - and as we all know Microsoft is NOT smart enough to read all rows (the first 8 records are read and assumes that if the first 8 rows are less than 255 characters then ALL the rows must be less than 255).
Of course this leads to truncation errors. Even if I set my SQL destination column value to nvarchar(max)
, SSIS will still error out. As I'm sure many have experienced simply using SSMS and importing an Excel file manually will generate this error. For my SSIS package, I have a data conversion task that supposedly converts the source data to a format that can then be brought into SQL Server. Apparently not.
Here is my simple data flow task with the offending column highlighted:
So, the limited solutions I've found online recommend sorting the data so that the widest text value is at the top so SQL Server can read it. I can't do this for hundreds of files each and every time. And I need the data in the original sort order, too, so that's not viable. Or I should insert a dummy record as the first row in the Excel file.
And how would this be done - in a script task? Again, over potentially hundreds of files? I've also heard I can change the registry somehow. Do I want to mess with that? Do any of these sound practical?
I have not seen anything online that's comparable to my situation - and I'm flummoxed. How can that be? I can't be the only one who experiences these types of truncation issues.
Anyway, I appreciate any and all help.
sql sql-server excel ssis truncation
add a comment |
up vote
0
down vote
favorite
I'm using SSIS 2012 and SQL Server 2014. I've had this issue forever and have YET to see a viable solution - and I'm not sure why more people don't experience this issue. Here is my simple data flow task:
I receive numerous Excel files from clients. The problem is that some of the fields contain text that is greater than 255 characters - and as we all know Microsoft is NOT smart enough to read all rows (the first 8 records are read and assumes that if the first 8 rows are less than 255 characters then ALL the rows must be less than 255).
Of course this leads to truncation errors. Even if I set my SQL destination column value to nvarchar(max)
, SSIS will still error out. As I'm sure many have experienced simply using SSMS and importing an Excel file manually will generate this error. For my SSIS package, I have a data conversion task that supposedly converts the source data to a format that can then be brought into SQL Server. Apparently not.
Here is my simple data flow task with the offending column highlighted:
So, the limited solutions I've found online recommend sorting the data so that the widest text value is at the top so SQL Server can read it. I can't do this for hundreds of files each and every time. And I need the data in the original sort order, too, so that's not viable. Or I should insert a dummy record as the first row in the Excel file.
And how would this be done - in a script task? Again, over potentially hundreds of files? I've also heard I can change the registry somehow. Do I want to mess with that? Do any of these sound practical?
I have not seen anything online that's comparable to my situation - and I'm flummoxed. How can that be? I can't be the only one who experiences these types of truncation issues.
Anyway, I appreciate any and all help.
sql sql-server excel ssis truncation
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm using SSIS 2012 and SQL Server 2014. I've had this issue forever and have YET to see a viable solution - and I'm not sure why more people don't experience this issue. Here is my simple data flow task:
I receive numerous Excel files from clients. The problem is that some of the fields contain text that is greater than 255 characters - and as we all know Microsoft is NOT smart enough to read all rows (the first 8 records are read and assumes that if the first 8 rows are less than 255 characters then ALL the rows must be less than 255).
Of course this leads to truncation errors. Even if I set my SQL destination column value to nvarchar(max)
, SSIS will still error out. As I'm sure many have experienced simply using SSMS and importing an Excel file manually will generate this error. For my SSIS package, I have a data conversion task that supposedly converts the source data to a format that can then be brought into SQL Server. Apparently not.
Here is my simple data flow task with the offending column highlighted:
So, the limited solutions I've found online recommend sorting the data so that the widest text value is at the top so SQL Server can read it. I can't do this for hundreds of files each and every time. And I need the data in the original sort order, too, so that's not viable. Or I should insert a dummy record as the first row in the Excel file.
And how would this be done - in a script task? Again, over potentially hundreds of files? I've also heard I can change the registry somehow. Do I want to mess with that? Do any of these sound practical?
I have not seen anything online that's comparable to my situation - and I'm flummoxed. How can that be? I can't be the only one who experiences these types of truncation issues.
Anyway, I appreciate any and all help.
sql sql-server excel ssis truncation
I'm using SSIS 2012 and SQL Server 2014. I've had this issue forever and have YET to see a viable solution - and I'm not sure why more people don't experience this issue. Here is my simple data flow task:
I receive numerous Excel files from clients. The problem is that some of the fields contain text that is greater than 255 characters - and as we all know Microsoft is NOT smart enough to read all rows (the first 8 records are read and assumes that if the first 8 rows are less than 255 characters then ALL the rows must be less than 255).
Of course this leads to truncation errors. Even if I set my SQL destination column value to nvarchar(max)
, SSIS will still error out. As I'm sure many have experienced simply using SSMS and importing an Excel file manually will generate this error. For my SSIS package, I have a data conversion task that supposedly converts the source data to a format that can then be brought into SQL Server. Apparently not.
Here is my simple data flow task with the offending column highlighted:
So, the limited solutions I've found online recommend sorting the data so that the widest text value is at the top so SQL Server can read it. I can't do this for hundreds of files each and every time. And I need the data in the original sort order, too, so that's not viable. Or I should insert a dummy record as the first row in the Excel file.
And how would this be done - in a script task? Again, over potentially hundreds of files? I've also heard I can change the registry somehow. Do I want to mess with that? Do any of these sound practical?
I have not seen anything online that's comparable to my situation - and I'm flummoxed. How can that be? I can't be the only one who experiences these types of truncation issues.
Anyway, I appreciate any and all help.
sql sql-server excel ssis truncation
sql sql-server excel ssis truncation
edited Nov 11 at 8:29
marc_s
566k12610931245
566k12610931245
asked Nov 11 at 5:38
Craig
438
438
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
Potential solutions:
1- Change the sample size by updating TypeGuessRows
in the registry key for HKEY_LOCAL_MACHINESOFTWAREMicrosoftJet4.0EnginesExcel
. Path might not be exactly same in your machine but would be similar.
2- Use Flat File Connection Manager
instead of Excel Connection Manager
, right click, go to Advanced Editor, go to Input and Output Properties tab, find your column on the left under Output Columns and set its length to 1000.
a "flat file connection manager" - for an EXCEL file??! How's that supposed to work? I tried connecting to my Excel source file and the editor couldn't even recognize any columns. Could you back up a step and show/advise how this works? Thanks.
– Craig
Nov 11 at 6:26
You can convert the excel into csv first, i believe.
– Eray Balkanli
Nov 11 at 6:27
Again, for potentially hundreds of files? What if the data has embedded commas? I appreciate the help but my experience with CSV files has been even more nightmarish.
– Craig
Nov 11 at 6:29
add a comment |
up vote
0
down vote
As a result of my own frustration with SSMS's inadequate diagnosis of data types in imported data, I wrote a tool to do the job instead. It works better for me; it might work better for you, if you're open to scripting solutions outside of the Microsoft environment. The tool is a Python script, available at https://pypi.org/project/execsql/. The IMPORT command will read an entire Excel or CSV file to determine data types, pretty much guaranteeing that the data will be imported successfully. Import from CSV is much faster than import from Excel, and line breaks inside columns of the CSV file are handled correctly.
Thank you. i will explore this option.
– Craig
Nov 12 at 17:19
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Potential solutions:
1- Change the sample size by updating TypeGuessRows
in the registry key for HKEY_LOCAL_MACHINESOFTWAREMicrosoftJet4.0EnginesExcel
. Path might not be exactly same in your machine but would be similar.
2- Use Flat File Connection Manager
instead of Excel Connection Manager
, right click, go to Advanced Editor, go to Input and Output Properties tab, find your column on the left under Output Columns and set its length to 1000.
a "flat file connection manager" - for an EXCEL file??! How's that supposed to work? I tried connecting to my Excel source file and the editor couldn't even recognize any columns. Could you back up a step and show/advise how this works? Thanks.
– Craig
Nov 11 at 6:26
You can convert the excel into csv first, i believe.
– Eray Balkanli
Nov 11 at 6:27
Again, for potentially hundreds of files? What if the data has embedded commas? I appreciate the help but my experience with CSV files has been even more nightmarish.
– Craig
Nov 11 at 6:29
add a comment |
up vote
0
down vote
Potential solutions:
1- Change the sample size by updating TypeGuessRows
in the registry key for HKEY_LOCAL_MACHINESOFTWAREMicrosoftJet4.0EnginesExcel
. Path might not be exactly same in your machine but would be similar.
2- Use Flat File Connection Manager
instead of Excel Connection Manager
, right click, go to Advanced Editor, go to Input and Output Properties tab, find your column on the left under Output Columns and set its length to 1000.
a "flat file connection manager" - for an EXCEL file??! How's that supposed to work? I tried connecting to my Excel source file and the editor couldn't even recognize any columns. Could you back up a step and show/advise how this works? Thanks.
– Craig
Nov 11 at 6:26
You can convert the excel into csv first, i believe.
– Eray Balkanli
Nov 11 at 6:27
Again, for potentially hundreds of files? What if the data has embedded commas? I appreciate the help but my experience with CSV files has been even more nightmarish.
– Craig
Nov 11 at 6:29
add a comment |
up vote
0
down vote
up vote
0
down vote
Potential solutions:
1- Change the sample size by updating TypeGuessRows
in the registry key for HKEY_LOCAL_MACHINESOFTWAREMicrosoftJet4.0EnginesExcel
. Path might not be exactly same in your machine but would be similar.
2- Use Flat File Connection Manager
instead of Excel Connection Manager
, right click, go to Advanced Editor, go to Input and Output Properties tab, find your column on the left under Output Columns and set its length to 1000.
Potential solutions:
1- Change the sample size by updating TypeGuessRows
in the registry key for HKEY_LOCAL_MACHINESOFTWAREMicrosoftJet4.0EnginesExcel
. Path might not be exactly same in your machine but would be similar.
2- Use Flat File Connection Manager
instead of Excel Connection Manager
, right click, go to Advanced Editor, go to Input and Output Properties tab, find your column on the left under Output Columns and set its length to 1000.
answered Nov 11 at 5:47
Eray Balkanli
3,85741943
3,85741943
a "flat file connection manager" - for an EXCEL file??! How's that supposed to work? I tried connecting to my Excel source file and the editor couldn't even recognize any columns. Could you back up a step and show/advise how this works? Thanks.
– Craig
Nov 11 at 6:26
You can convert the excel into csv first, i believe.
– Eray Balkanli
Nov 11 at 6:27
Again, for potentially hundreds of files? What if the data has embedded commas? I appreciate the help but my experience with CSV files has been even more nightmarish.
– Craig
Nov 11 at 6:29
add a comment |
a "flat file connection manager" - for an EXCEL file??! How's that supposed to work? I tried connecting to my Excel source file and the editor couldn't even recognize any columns. Could you back up a step and show/advise how this works? Thanks.
– Craig
Nov 11 at 6:26
You can convert the excel into csv first, i believe.
– Eray Balkanli
Nov 11 at 6:27
Again, for potentially hundreds of files? What if the data has embedded commas? I appreciate the help but my experience with CSV files has been even more nightmarish.
– Craig
Nov 11 at 6:29
a "flat file connection manager" - for an EXCEL file??! How's that supposed to work? I tried connecting to my Excel source file and the editor couldn't even recognize any columns. Could you back up a step and show/advise how this works? Thanks.
– Craig
Nov 11 at 6:26
a "flat file connection manager" - for an EXCEL file??! How's that supposed to work? I tried connecting to my Excel source file and the editor couldn't even recognize any columns. Could you back up a step and show/advise how this works? Thanks.
– Craig
Nov 11 at 6:26
You can convert the excel into csv first, i believe.
– Eray Balkanli
Nov 11 at 6:27
You can convert the excel into csv first, i believe.
– Eray Balkanli
Nov 11 at 6:27
Again, for potentially hundreds of files? What if the data has embedded commas? I appreciate the help but my experience with CSV files has been even more nightmarish.
– Craig
Nov 11 at 6:29
Again, for potentially hundreds of files? What if the data has embedded commas? I appreciate the help but my experience with CSV files has been even more nightmarish.
– Craig
Nov 11 at 6:29
add a comment |
up vote
0
down vote
As a result of my own frustration with SSMS's inadequate diagnosis of data types in imported data, I wrote a tool to do the job instead. It works better for me; it might work better for you, if you're open to scripting solutions outside of the Microsoft environment. The tool is a Python script, available at https://pypi.org/project/execsql/. The IMPORT command will read an entire Excel or CSV file to determine data types, pretty much guaranteeing that the data will be imported successfully. Import from CSV is much faster than import from Excel, and line breaks inside columns of the CSV file are handled correctly.
Thank you. i will explore this option.
– Craig
Nov 12 at 17:19
add a comment |
up vote
0
down vote
As a result of my own frustration with SSMS's inadequate diagnosis of data types in imported data, I wrote a tool to do the job instead. It works better for me; it might work better for you, if you're open to scripting solutions outside of the Microsoft environment. The tool is a Python script, available at https://pypi.org/project/execsql/. The IMPORT command will read an entire Excel or CSV file to determine data types, pretty much guaranteeing that the data will be imported successfully. Import from CSV is much faster than import from Excel, and line breaks inside columns of the CSV file are handled correctly.
Thank you. i will explore this option.
– Craig
Nov 12 at 17:19
add a comment |
up vote
0
down vote
up vote
0
down vote
As a result of my own frustration with SSMS's inadequate diagnosis of data types in imported data, I wrote a tool to do the job instead. It works better for me; it might work better for you, if you're open to scripting solutions outside of the Microsoft environment. The tool is a Python script, available at https://pypi.org/project/execsql/. The IMPORT command will read an entire Excel or CSV file to determine data types, pretty much guaranteeing that the data will be imported successfully. Import from CSV is much faster than import from Excel, and line breaks inside columns of the CSV file are handled correctly.
As a result of my own frustration with SSMS's inadequate diagnosis of data types in imported data, I wrote a tool to do the job instead. It works better for me; it might work better for you, if you're open to scripting solutions outside of the Microsoft environment. The tool is a Python script, available at https://pypi.org/project/execsql/. The IMPORT command will read an entire Excel or CSV file to determine data types, pretty much guaranteeing that the data will be imported successfully. Import from CSV is much faster than import from Excel, and line breaks inside columns of the CSV file are handled correctly.
answered Nov 11 at 18:12
rd_nielsen
1,6152615
1,6152615
Thank you. i will explore this option.
– Craig
Nov 12 at 17:19
add a comment |
Thank you. i will explore this option.
– Craig
Nov 12 at 17:19
Thank you. i will explore this option.
– Craig
Nov 12 at 17:19
Thank you. i will explore this option.
– Craig
Nov 12 at 17:19
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53246142%2fssis-import-excel-to-sql-truncation-issues%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown