简体   繁体   English

使用SSIS DatFlowTask将数据从SQL Server导出到Excel时,如何避免“数字存储为文本”错误

[英]How to avoid 'number stored as text' error when exporting data from SQL Server to Excel using SSIS DatFlowTask

I am using a SSIS Data Flow Task to export data from SQL Server to an Excel destination, but while exporting it converts int values to "Numbers Stored As Text" Excel cells and every cell gets this error "number stored as text" with a green tag. 我正在使用SSIS数据流任务将数据从SQL Server导出到Excel目标,但是在导出它时,会将int值转换为“数字存储为文本” Excel单元格,每个单元格都会显示此错误“数字存储为文本”标签。

Can you please guide me how I can export my int values from SQL Server to a number in Excel? 您能否指导我如何将SQL Server中的int值导出到Excel中的数字?

Thanks 谢谢

The solution that has worked for me is to add numeric values to the numeric columns so that it knows to format the destination as numeric in your template sheet. 对我有用的解决方案是将数字值添加到数字列,以便它知道将目标格式设置为模板表中的数字。 You can either hide the values or overwrite them with the new data that you are posting to the file. 您可以隐藏值,也可以用要发布到文件中的新数据覆盖它们。

So essentially just add a row with template data and formatting and hide that row. 因此,从本质上讲,只需添加一行包含模板数据和格式并隐藏该行。 When the import occurs, it will copy the first (hidden) row formatting. 导入时,它将复制第一个(隐藏的)行格式。

as you are importing the values to a excel their should be data conversion, if not you will get an error. 当您将值导入到excel时,它们应该是数据转换,否则将出现错误。

Please see the link below for more details: Error converting data types when importing from Excel to SQL Server 2008 请参阅下面的链接以获取更多详细信息: 从Excel导入SQL Server 2008时转换数据类型时出错

Warm Regards Safi 热烈问候

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

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