I'm trying to import a csv file with two columns (sku, description) into SQL Server 2008 using the SQL Server management studio 2012 import/export wizard. Because the description column definitely has rows greater than 8000 characters, I go to the advanced tab when choosing the csv data source and click on the description column and click "Suggest Types". It then puts in 16718 for the OutPutColumnWidth property. Apparently there is a description in there somewhere that is THAT long.
The sql it generates is:
CREATE TABLE [dbo].[mag-prod-descriptions1] (
[sku] varchar(7),
[descrip] varchar(16718)
)
However, when I execute the import, I get the error "Could not connect source component. Error 0xc0204016: SSIS.Pipeline: The "Source - mag-prod-descriptions1_csv.Outputs[Flat File Source Output].Columns[Column 1]" has a length that is not valid. The length must be between 0 and 8000."
If I change the OutputColumnWidth property to 8000 then I get an error saying the column was truncated. I can't win.
How do I get the thing to allow me to import cells that are greater than 8000 characters?
Remember, whenever you are planning to insert more than 8000 characters to any varchar column, you must cast it as varchar(max) before insertion.
The best, quickest and easiest way to resolve the comma in data issue is to use Excel to save a comma separated file after having set Windows' list separator setting to something other than a comma (such as a pipe). This will then generate a pipe (or whatever) separated file for you that you can then import.
Ack. Finally got it. The answer was to use the Text Stream datatype for the large column on the source file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With