简体   繁体   English

在 SSIS 中将 VARCHAR(MAX) 字段从 SQL 导出到 Excel

[英]Exporting a VARCHAR(MAX) Field from SQL to Excel in SSIS

I'm creating a SSIS Package to export Data from a SQL Server Table into an Excel Sheet.我正在创建一个 SSIS 包以将数据从 SQL Server 表导出到 Excel 表中。 My Table has one column of datatype VARCHAR(MAX) .我的表有一列数据类型为VARCHAR(MAX) And this column can have data as big as 30,000 characters sometimes.并且此列有时会包含多达 30,000 个字符的数据。 So I used a Data Conversion block to convert that column's DataType from it's original datatype text stream [DT_TEXT] to Unicode text stream [DT_NTEXT] .因此,我使用数据转换块将该列的 DataType 从其原始数据类型text stream [DT_TEXT]Unicode text stream [DT_NTEXT] But when I execute the Package, I get this error An error occurred while setting up a binding for the "MyColumnName" column.但是当我执行包时,我收到这个错误为“MyColumnName”列设置绑定时发生错误。 The binding status was "DT_NTEXT" .绑定状态为 "DT_NTEXT"

I googled a lot but I couldn't get an answer to my problem.我用谷歌搜索了很多,但我无法得到我的问题的答案。 I'd appreciate all the help that I could get.我很感激我能得到的所有帮助。

You can skip the data conversion task and just force the type when you extract from SQL Server SELECT CAST(MyBigColumn AS nvarchar(max)) As MyBigColumnUnicode but you're going to run into the problem that a cell in Excel cannot hold 100k characters.当您从 SQL Server SELECT CAST(MyBigColumn AS nvarchar(max)) As MyBigColumnUnicode提取时,您可以跳过数据转换任务并仅强制类型,但是您将遇到 Excel 中的单元格不能容纳 100k 个字符的问题。

Total number of characters that a cell can contain: 32,776一个单元格可以包含的字符总数:32,776

Excel specifications and limits Excel 规格和限制

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM