I have an excel file with four text columns: one of them is called ShortDescription which has the longest value. I created a table in SQL Server 2008 database, with four col
For me this link helped me : https://support.microsoft.com/en-us/kb/189897
A simple way to get it to work is edit the file you want to import and create a new row in the first spot. That way it will always be sampled. Then for any columns that may have >255 characters, just add 255 characters to the cell and it will work. After you import, just delete out the junk row you added.
I got this error when I was trying to import a large file that had some chinese characters in it, and also some invalid (large) strings.
The text file was saved in UTF8 format.
My settings:
On the General Option (didn't change anything):
- Locale: English (United States)
- Unicode: Unchecked
- Code Page: 65001 (UTF-8)
There is an Advanced Option on the left
- DataType (for column): Unicode String [DT_WSTR] (changed)
- OutputColumnWidth: 4000 (that's the maximum) (changed)
On the Review Data Type Mapping
- On Error: Ignore
- On Truncation: Ignore
My target column had width = 50.
I got no errors with these settings.
I assume you're trying to import this using an Excel Source in the SSIS dialog?
If so, the problem is probably that SSIS samples some number of rows at the beginning of your spreadsheet when it creates the Excel source. If on the [ShortDescription] column it doesn't notice anything too large, it will default to a 255 character text column.
So to import data from a column that contains rows with large amounts of data without truncation, there are two options:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Excel
(of if your system is x64 then under the HKEY_LOCAL_MACHINE\SOFTWARE\wow6432node\Microsoft\Jet\4.0\Engines\Excel
)
registry key.You can see more information at these two links:
To further explain, SSIS creates 3 objects behind the scenes of the wizard, an Excel data source object, a SQL table destination object, and a data flow operator between them. The Excel source object defines the source data and exists independent of the other two objects. So when it's created, the sampling I described is done and the source column size is set. So by the time the data flow operator executes and tries to pull the data from excel to put in your table, it's already looking at a data source that's been limited to 255 characters.
Try this - Go to Data Flow Task > Right click on Excel Data Source > Click on Show Advance Editor > Select Input and Output Properties > Expand Excel Source Output > Expand External Columns and Output Columns and check the erroneous columns and click on those column headers and update Data Type accordingly (Mostly that should be Unicode text stream [DT_NTEXT], otherwise change to that and give it a try). Hope this help.
I had this issue when importing from a flat, delimited file into SQL Server. The solution was to update the 'OutputColumnWidth' value for the offending column (from the error message). On the 'Choose a Data Source' form in the import wizard, my source was the flat file. On the leftmost pane, choose 'Advanced'. You can then set the properties of individual columns. In my case, the 'OutputColumnWidth' for most of my columns was defaulted to '50'. I simply updated it to a larger value that would not truncate the value from the flat file.