如何使用每个循环将多个表从SQL Server导出到多个Excel文件中 [英] How can I export multiple tables from SQL server into multiple Excel files using for each loop

查看:471
本文介绍了如何使用每个循环将多个表从SQL Server导出到多个Excel文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用for循环将多个表从SQL Server导出到多个Excel文件中。例如......我有2个雇主和部门表。我想将它们导出到employer.xls和department.xls。



我有100个文件来使用SQL Server DB中的SSIS执行类似的导出。请指导我。我的目的地是Excel 2010.

How can I export multiple tables from SQL server into multiple Excel files using for each loop. For example... i have 2 tables employer and department. I want to export them to employer.xls and department.xls.

I have 100s of files to perform similar exports using SSIS from SQL server DB. Please guide me. My destination is Excel 2010.

推荐答案

请参阅使用命令行运行SSIS包

http://www.excel-sql-server.com/sql-server-export-to-excel-using -ssis.htm [ ^ ]



您可以轻松配置重复导出的步骤。



但无论如何你应该为每张桌子准备SSIS套餐。



你可以用更简单的方式。



只需将表格导出为CSV文件,然后在Excel中打开它们并使用自动化将它们另存为Excel工作簿。
See SSIS Packages Run using Command Line at
http://www.excel-sql-server.com/sql-server-export-to-excel-using-ssis.htm[^]

You may easily configure steps to repeat exporting.

But in any case you should prepare SSIS packages for every table.

You may use simpler way.

Just export your tables into CSV files, then open them in Excel and save them as an Excel workbooks using automation.


这篇关于如何使用每个循环将多个表从SQL Server导出到多个Excel文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆