简体   繁体   English

SQL导出到多个Excel工作表

[英]SQL Export to multiple Excel Worksheets

everyone! 大家! I'm mostly just curious if this can be done, but here we go: I have a query I run about once a month that ends up going into an Excel Worksheet. 我主要是想知道是否可以这样做,但是现在我们开始:我有一个查询,我大约每月运行一次,最后进入Excel工作表。 It creates a list of businesses and representatives. 它创建企业和代表的列表。 Now, I know that you can create SQL code that exports query results directly to a worksheet (see Export SQL query data to Excel ), but I want to know if I can take the result, and export it using SQL to multiple worksheets based on representative? 现在,我知道您可以创建将查询结果直接导出到工作表的SQL代码(请参阅将SQL查询数据导出到Excel ),但是我想知道是否可以接受结果,并使用SQL将结果导出到基于代表? So that each rep gets a worksheet of just their businesses? 这样每个代表都能得到一份仅涉及其业务的工作表? I'm thinking it would involve some kind of loop (see SQL Server FOR EACH Loop ), but I just can't find anything definitive. 我认为这会涉及某种循环(请参阅SQL Server FOR EACH循环 ),但是我找不到任何确定的东西。 Thoughts? 思考? Thanks! 谢谢!

You can create an SSIS package to achieve that. 您可以创建一个SSIS包来实现。 Write a different query for each rep and export the results into an Excel. 为每个代表编写一个不同的查询,然后将结果导出到Excel中。

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

相关问题 在单个excel文件中将多个数据网格导出到不同的工作表 - Export multiple datagrids to different worksheets on a single excel file SSRS-具有多个工作表的Excel导出显示了不同的报告/不同的查询结果(可能?) - SSRS - Excel export with multiple worksheets showing different report/different query results (Possible??) 将SQL查询导出到具有多个工作表的Excel文件 - Export SQL Query to Excel File with multiple sheets 多个Excel工作表导入/导出到SQL Server - Multiple excel sheets import/export to SQL Server 使用多个值的Excel列从Excel导出到SQL Server - Export from Excel to SQL Server with Excel Column of Multiple Values 将表内容导出到不同的EXCEL文件和不同的工作表 - Export contents of table to different EXCEL files and different worksheets SQL Server-将参数列表转换为函数,将多个结果导出至Excel - SQL Server - List of parameters into function, Export Multiple results into Excel 如何将多个 sql 查询结果导出到 Postgresql 中的一个 Excel 文件中 - How to export multiple sql query results into one Excel file in Postgresql SQL Server导出到Excel - SQL Server export to Excel 将 SQL 开发人员的多个表导出到单个 excel - Export multiple tables from SQL developer into a single excel
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM