Batch export data SSIS

本小妞迷上赌 提交于 2020-01-16 17:58:25

问题


I have a requirement where I'm pulling large amounts of data from SQL Server and will have to insert this data into Excel files.

Now, each excel file must not have more than 1000 rows. These excel files will have to created on the fly.

Please help


回答1:


I suggest you wrap your logic in a loop container. Logically, it would look like this:

  • Count the number of rows ready to export to excel. Divide by 1000, round up and set as a variable. (EX. 5049 rows -> 6)
  • Have a loop container loop on the new variable.

    • Within the loop, select the subset of rows by adding a row number to the query (make sure its ordered...) with something like row >= (<variable>-1)*1000 AND row < (<variable>)*1000
    • You can use an expression to name the file with the variable appended to the end to give a unique name. EX. "<filename>_" + DT_WSTR <variable> + ".xls" to get something like dataset_1.xls, dataset_2.xls...


来源:https://stackoverflow.com/questions/23323311/batch-export-data-ssis

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!