基于更改存储过程的 SQL Server 2008 作业
我已经浏览了 SQL Server 问题和答案,但没有看到这个问题的答案,如果有,但我错过了,请告诉我。
情况如下:
我编写存储过程和视图,然后将它们作为报告运行(使用 Crystal) - 这不是问题。在我能够将报告发布到生产环境之前,我需要让最终用户运行报告并检查它们是否有错误等。在完美的世界中,我将拥有一个冻结的测试环境,但我并不生活在一个完美的世界。每天晚上我放入测试环境中的所有内容都会被清除,每天早上最终用户测试中的所有内容都需要重新添加。这意味着当我进来时,我做的第一件事就是运行所有存储过程,以及一个在我们使用的程序中取消隐藏报告的脚本。
我希望能够做的是编写一个包,该包可以在文件夹中查找所有存储过程并执行它们以将它们添加到数据库中,然后运行取消隐藏报告的脚本。
我知道如何设置 SSIS 包来运行存储过程,但我不知道如何设置一个可以运行不断变化的存储过程列表的包。这可能吗?如果是的话,我该如何开始呢?
我应该指出,虽然我有超过 10 年的查询编写经验,但自从 VB 6.0 以来我就没有使用过 VB,而且我对 SSIS 和 SSRS 世界还很陌生。
提前致谢!
I have looked through the SQL Server questions and answers and I didn't see an answer to this one, if it is out there and I've missed it, please let me know.
Here's the situation:
I write stored procedures and views that are then run as reports (using Crystal) - this is not the problem. Before I am able to release the reports into Production, I need to have the end users run the reports and check them for errors, etc. In a perfect world, I would have a frozen test environment, but I don't live in a perfect world. Every night everything I place into my test environment is wiped out and every morning anything that is in end user testing needs to be re-added. This means that when I come in the first thing I do is run all of the stored procedure, along with a script that unhides the reports in the program we use.
What I'd like to be able to do is to write a package that would find all of the stored procedures in a folder and execute them to add them to the database and, then, run the script that unhides the reports.
I know how to set up an SSIS package to run a stored procedure, but I don't know how to set one up that would run an ever changing list of stored procedures. Is this even possible? And, if it is, how do I go about starting this up?
I should note that while I have more then 10 years of query writing experience, I haven't used VB since VB 6.0 and I very new to the SSIS and SSRS world.
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好的旧 nt shell 就可以解决这个问题。在包含文件的文件夹中运行此语句。
如果你想将它包含在批处理文件中,它可能看起来像
Good old nt shell will do the trick. Run this statement in the folder containing the files.
if you want to include it in a batch file it could look like
这实际上听起来更像是一个部署问题,而不是 SQL 问题。查看 Jenkins CI。我相信它主要用于代码构建和部署,但它也可以用于任何自动化任务。
如果您有一个 SQL 文件列出了所有已更改的过程及其关联文件,您可以使用该单个脚本来运行所有其他脚本 http://www.devx.com/tips/Tip/15132。就此而言,您可以使用计划任务每天早上运行它。
再添加一个步骤,您可以根据文件夹的内容构建文件(使用一点 Powershell 脚本 等)。
我不确定尝试在 SSIS 包中完成这一切是否是适合该工作的工具。
This actually sounds like it may be more of a deployment issue than a SQL one. Take a look at Jenkins CI. I believe it's mostly used for code build and deployment, but it can also be used for any automated task.
If you had one SQL file that listed all the changed procs and their associated files you can use that single script to run all the others http://www.devx.com/tips/Tip/15132. For that matter you could just use a scheduled task to run it every morning.
Adding one more step, you could build the file based on the contents of a folder (using a little Powershell script or the like).
I'm not sure trying to do this all within an SSIS package is the right tool for the job.