自动计划要导出到csv文件的SQL查询结果 [英] Automatically scheduling SQL query results to be exported to a csv file

查看:120
本文介绍了自动计划要导出到csv文件的SQL查询结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已尝试阅读有关该主题的内容,但仍不清楚如何进行.这似乎是一项相当基本的任务,但它远没有我想象的那么简单.我编写了几个SQL查询,我希望能够安排它们在每月的某一天运行,然后自动导出到选定文件夹中的.csv文件.然后,这将允许它们自动上载到我们公司使用的BI和报告工具中(这部分我知道如何处理).

I have tried to read up on this topic and I am still a bit unclear how to proceed. This seemed like a fairly basic task but it has been nowhere as simple as I had assumed. I have several SQL queries written and I want to be able to schedule them to run on a certain day each month and then automatically be exported to a .csv file in a selected folder. This will then allow them to be automatically uploaded into a BI and reporting tool that our firm uses (this part I know how to take care of).

我对SQL查询的编写非常精通,但除此之外的所有内容我都很迷失.现在,我使用的是Microsoft SQL Management Studio17.我认为也许可以使用SQL Server Agent计划作业,但是我越了解并走这条路,就越不相信它可以帮助我将查询结果导出到需要提取的.csv文件中.同样重要的是,这些结果要在没有标题的情况下导出.

I am fairly well versed in the writing of SQL queries, but everything beyond that I am pretty lost on. Right now I am using Microsoft SQL Management Studio 17. I thought that maybe scheduling jobs using the SQL Server Agent would be the solution, but the more I read about that and go down that path, the less I am convinced that it will allow me to export the query results into the .csv file that I need for it to be picked up. It is also important that these results are exported without headers.

有人对此有任何解决方案吗?如果我不清楚,我很乐意回答任何后续问题.

Does anyone have any solutions for this? I am happy to answer any follow up questions if I am at all unclear.

推荐答案

您可以在SQL Server Management Studio中创建一个作业来处理整个事情.

You can create a job within the SQL server management studio to handle the whole thing.

http://social .msdn.microsoft.com/Forums/zh-CN/transactsql/thread/7d2280cf-3b33-46f7-ba82-4131e8a841c0

这篇关于自动计划要导出到csv文件的SQL查询结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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