[英]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.