{"id":837,"date":"2015-02-16T02:06:11","date_gmt":"2015-02-16T02:06:11","guid":{"rendered":"http:\/\/www.theSQLReport.com\/?p=837"},"modified":"2015-02-16T02:06:11","modified_gmt":"2015-02-16T02:06:11","slug":"error-0xc0204016-ssis-pipeline-the-length-must-be-between-0-and-8000","status":"publish","type":"post","link":"http:\/\/www.theSQLReport.com\/?p=837","title":{"rendered":"Error 0xc0204016: SSIS.Pipeline &#8230; The length must be between 0 and 8000."},"content":{"rendered":"<p>About once a year, I am asked to import some text files into a table in a SQL Server database.\u00a0 To accomplish this, I am using the SQL Server 2008 Import and Export Wizard.\u00a0 My recent struggle was with the records that had more then 8000 characters in a column.<\/p>\n<p>I was seeing two types of warnings:<\/p>\n<address style=\"padding-left: 30px;\">The Size value is invalid.<br \/>\nAdditional information:<br \/>\nThe entered value is out of the allowed range for the &#8220;varchar&#8221; data type.<br \/>\nThe valid values are greater than or equal to 1 and less than or equal to 8000.(DTSWizard)<\/address>\n<address>\u00a0<\/address>\n<div id=\"attachment_839\" style=\"width: 894px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/12\/Varchar8000_Warning.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-839\" class=\"wp-image-839 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/12\/Varchar8000_Warning.jpg\" alt=\"Varchar8000_Warning\" width=\"884\" height=\"508\" \/><\/a><p id=\"caption-attachment-839\" class=\"wp-caption-text\">value is out of the allowed range for the &#8220;varchar&#8221; data type<\/p><\/div>\n<p>The other error was when I attempted the perform the import operation:<\/p>\n<address style=\"padding-left: 30px;\">Could not connect source component.<\/address>\n<address style=\"padding-left: 30px;\">Error 0xc0204016:: SSIS.Pipeline: The &#8220;Source &#8211; &lt; file name &gt;_csv.Outputs[Flat File Source Output].Columns[ &lt; column name &gt; ]&#8221;<\/address>\n<address style=\"padding-left: 30px;\">has a length that is not valid. The length must be between 0 and 8000.<\/address>\n<address style=\"padding-left: 30px;\">Additional information:<\/address>\n<address style=\"padding-left: 30px;\">Exception from HRESULT: 0xc0204016(Microsoft.SqlServer.DTSPipelineWrap)<\/address>\n<address style=\"padding-left: 30px;\">\u00a0<\/address>\n<address style=\"padding-left: 30px;\">\u00a0<\/address>\n<div id=\"attachment_840\" style=\"width: 797px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/12\/Error_0xc0204016.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-840\" class=\"wp-image-840 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/12\/Error_0xc0204016.jpg\" alt=\"Error_0xc0204016\" width=\"787\" height=\"644\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/12\/Error_0xc0204016.jpg 787w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/12\/Error_0xc0204016-300x245.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/12\/Error_0xc0204016-210x171.jpg 210w\" sizes=\"(max-width: 787px) 100vw, 787px\" \/><\/a><p id=\"caption-attachment-840\" class=\"wp-caption-text\">Error 0xc0204016<\/p><\/div>\n<h1><strong>RESOLUTION:<\/strong><\/h1>\n<p>To resolve this issue, it started on the<strong> &#8220;Choose a Data Source&#8221; screen.<\/strong>\u00a0 After I had chosen the CSV file, in the left panel, I <strong>clicked on &#8220;Advanced&#8221;<\/strong>.\u00a0 Then I <strong>clicked on any of the columns<\/strong>.\u00a0\u00a0 Notice that I click on the &#8220;LastAction&#8221; column.\u00a0 In the right panel, the Data Type is &#8220;string [DT_STR]&#8221;, and the OutputColumnWidth is 50.\u00a0\u00a0 Next I <strong>Clicked on the &#8220;Suggest Type&#8230;&#8221; button.<\/strong><\/p>\n<div id=\"attachment_848\" style=\"width: 582px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/12\/ChooseADataSource.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-848\" class=\"wp-image-848 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/12\/ChooseADataSource.jpg\" alt=\"ChooseADataSource\" width=\"572\" height=\"583\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/12\/ChooseADataSource.jpg 572w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/12\/ChooseADataSource-294x300.jpg 294w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/12\/ChooseADataSource-206x210.jpg 206w\" sizes=\"(max-width: 572px) 100vw, 572px\" \/><\/a><p id=\"caption-attachment-848\" class=\"wp-caption-text\">Choose a Data Source screen<\/p><\/div>\n<p>A pop up box appears named<strong> &#8220;Suggested Column Types&#8221;<\/strong>.\u00a0 In the <strong>&#8220;Number of rows:&#8221; text box, enter the estimate number of rows<\/strong> in the CSV or text file.\u00a0 I had found the number of rows in my import file by previewing it in Excel.\u00a0 Then I <strong>clicked the OK button<\/strong>.\u00a0 This may take a while, depending on the number of rows.\u00a0 I have gone as high as 500,000 rows, which took a couple of minutes.\u00a0 This processes scans the file, and gives recommended data types with the size.<\/p>\n<div id=\"attachment_850\" style=\"width: 447px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/12\/SuggestColumnTypes.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-850\" class=\"wp-image-850 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/12\/SuggestColumnTypes.jpg\" alt=\"SuggestColumnTypes\" width=\"437\" height=\"371\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/12\/SuggestColumnTypes.jpg 437w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/12\/SuggestColumnTypes-300x254.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2014\/12\/SuggestColumnTypes-210x178.jpg 210w\" sizes=\"(max-width: 437px) 100vw, 437px\" \/><\/a><p id=\"caption-attachment-850\" class=\"wp-caption-text\">Suggest Column Types Pop-Up Box<\/p><\/div>\n<p>I searched each of the columns to find any column with a width greater then 8,000 characters.\u00a0 In the example below, the &#8220;Last Action&#8221; column has a record with 14,409 characters in it.<\/p>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2015\/02\/Resolution03.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-873 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2015\/02\/Resolution03.jpg\" alt=\"Resolution03\" width=\"793\" height=\"647\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2015\/02\/Resolution03.jpg 793w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2015\/02\/Resolution03-300x244.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2015\/02\/Resolution03-210x171.jpg 210w\" sizes=\"(max-width: 793px) 100vw, 793px\" \/><\/a><\/p>\n<p>To resolve this issue, the Data Type is going to need to be changed, because the &#8220;string [DT_STR]&#8221; can hold at max 8,000 characters.\u00a0 By changing the Data Type to something like &#8220;text stream [DT_TEXT]&#8221;, allows for more then the 8,000 character limit.\u00a0 The Output column width will change to zero when I chose &#8220;text stream [DT_TEXT]&#8221;.<\/p>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2015\/02\/Resolution04a.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-881 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2015\/02\/Resolution04a.jpg\" alt=\"Resolution04a\" width=\"788\" height=\"645\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2015\/02\/Resolution04a.jpg 788w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2015\/02\/Resolution04a-300x245.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2015\/02\/Resolution04a-210x171.jpg 210w\" sizes=\"(max-width: 788px) 100vw, 788px\" \/><\/a><\/p>\n<p>At that point, I was able to continue on with the export process.\u00a0 I did have to watch the column sizes on my table being imported into.\u00a0 However my import was successful.<\/p>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2015\/02\/SuccessfulImport.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-877 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2015\/02\/SuccessfulImport.jpg\" alt=\"SuccessfulImport\" width=\"733\" height=\"582\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2015\/02\/SuccessfulImport.jpg 733w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2015\/02\/SuccessfulImport-300x238.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2015\/02\/SuccessfulImport-210x166.jpg 210w\" sizes=\"(max-width: 733px) 100vw, 733px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>About once a year, I am asked to import some text files into a table in a SQL Server database.\u00a0 To accomplish this, I am using the SQL Server 2008 &hellip; <a class=\"readmore\" href=\"http:\/\/www.theSQLReport.com\/?p=837\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":839,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-837","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sql-server"],"_links":{"self":[{"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/837"}],"collection":[{"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=837"}],"version-history":[{"count":17,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/837\/revisions"}],"predecessor-version":[{"id":882,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/837\/revisions\/882"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/media\/839"}],"wp:attachment":[{"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=837"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=837"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=837"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}