生成多个和过滤的液滴 + 创建存储过程
我有这个脚本:
select name,create_date,modify_date from sys.procedures order by modify_date desc
我可以看到最近修改了哪些程序。 我将添加一个“其中modify_date > =” 我想使用一些系统存储过程,它将生成我: drop + 为(比方说 5 个匹配的)存储过程创建脚本
我可以以某种方式执行此操作吗?
谢谢
,好的。 我有最终版本:
http://swooshcode。 blogspot.com/2008/10/generate-stored-procedures-scripts-for.html
你们帮了很多
忙,谢谢
I have this script:
select name,create_date,modify_date from sys.procedures order by modify_date desc
I can see what procedures were modified lately.
I will add a "where modify_date >= "
And I'd like to use some system stored procedure, that will generate me :
drop + create scripts for the (let's say 5 matching) stored procedures
Can i do this somehow?
thanks
ok. i have the final version:
http://swooshcode.blogspot.com/2008/10/generate-stored-procedures-scripts-for.html
you guys helped a lot
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
这不太漂亮,但很有效。 手动运行其输出或使用 sp_executesql 执行它。
您还必须担心失去权利。
This ain't pretty, but it works. Run the output from it manually or execute it with sp_executesql.
You will have to worry about lost rights as well.
不需要游标(根据模式等需要进行修改):
No cursor necessary (modify as desired for schemas, etc):
您可以使用游标来迭代每条记录:
You could use a cursor to iterate through each record:
与此同时,我做了一些挖掘,似乎就是
我需要的,(加上当我问问题时我已经知道的部分,jdecuyper 解释了更多)
meanwhile i did some digging, and seems like
is what i need, (plus the part that i already knew when i asked the question explained more by jdecuyper)
最好使用比 SQL 更合适的语言来完成此操作。 尽管有许多扩展,例如 T-SQL、PL/SQL 和 PL/pgSQL,但 SQL 并不是执行此任务的最佳选择。
这里是一个类似问题的链接,我的答案是使用 SQL-DMO 或 SMO,具体取决于您有 SQL 2000 还是 2005。
如何使用 c# 复制数据库
This is best done in a more suitable language than SQL. Despite its numerous extensions such as T-SQL, PL/SQL, and PL/pgSQL, SQL is not the best thing for this task.
Here is a link to a similar question, and my answer, which was to use SQL-DMO or SMO, depending on whether you have SQL 2000 or 2005.
How to copy a database with c#