简体   繁体   English

将临时表导出到SSIS中的excel

[英]Export temp table to excel in SSIS

Hi everyone I have small doubt in SSIS package: 大家好,我对SSIS程序包有一点怀疑:

I am using a stored procedure which is giving set of records, finally these records will be saved in temp table. 我正在使用一个提供记录集的存储过程,最后这些记录将保存在临时表中。

The thing is now I want this records to be exported to excel, so I planned to use SSIS package to do that. 现在,我希望将此记录导出到excel,因此我计划使用SSIS包来做到这一点。 Now the problem is how will I define the OLE DB source in SSIS, because since am using #temptable at the runtime in stored procedure it will not be displayed in source of SSIS. 现在的问题是,我将如何在SSIS中定义OLE DB源,因为由于在存储过程中在运行时使用#temptable ,因此它将不会显示在SSIS源中。

Kindly suggest to Export temp table to Excel files. 请建议将临时表导出到Excel文件。

That fact that you're using a temp table is not likely to matter too much. 您正在使用临时表这一事实可能不太重要。 Is your temp table used in the stored procedure logic which outputs a select statement? 您的临时表是否在输出选择语句的存储过程逻辑中使用? If yes, then in your OLE DB source set Data Access Mode to SQL Command and call the store procedure ( EXEC myStoredProcedure ). 如果是,则在OLE DB源中将“数据访问模式”设置为“ SQL命令”,然后调用存储过程( EXEC myStoredProcedure )。

Using a #temptable can be problematic in SSIS. 在SSIS中使用#temptable可能会出现问题。 If you need to access a temp table in different data flows or transformations, then you will need to used the global ##temptable . 如果您需要访问不同数据流或转换中的临时表,则需要使用全局##temptable

Review this question , the answer goes into great detail on using temp tables. 复习此问题 ,答案将在使用临时表方面变得非常详细。

Another Reference: SSIS: Using temporary tables 另一个参考: SSIS:使用临时表

You can use Execute SQL Task to execute the stored procedure, load the data into the temp table. 您可以使用“执行SQL任务”执行存储过程,将数据加载到临时表中。

You can access the temp table with Query command instead of select from the drop-down list. 您可以使用Query命令访问临时表,而不是从下拉列表中进行选择。

Remember set up the connection manager's property RetainSameConnection as TRUE 记住将连接管理器的属性RetainSameConnection设置为TRUE

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

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