如何在 Powershell 中获取 SQL 存储过程的内容? [英] How do I get the content of a SQL Stored Procedure in Powershell?

查看:33
本文介绍了如何在 Powershell 中获取 SQL 存储过程的内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我讨厌在树视图中探索代码和数据库结构,我更喜欢使用 Powershell 之类的东西.我需要在 SQL 中做的大部分事情都是探索,即查看表有哪些列或特定存储过程有什么作用.

I'm perverted in the sense that I hate exploring code and database structures in a tree view and I'd much prefer using something like the Powershell for that. Most of the stuff I need to do in SQL is exploring, i.e. looking at what columns does a table have or what does a particular stored procedure do.

查看表列就像查看表的列目录一样简单,但如何获取存储过程的内容?

Looking at table columns is as easy as ls'ing the columns directory of a table, but how would I get the contents of a stored procedure?

推荐答案

如果您想在 Sql Server 2008 上运行它,那么 这里有一个 Cmdlet 可以帮助您.

If you want to run this on Sql Server 2008 then here is a Cmdlet that will help you with it.

如果您使用的是 Sql Server 2005 那么这里是一个 页面一个脚本来帮助你解决这个问题.

If you are using Sql Server 2005 then here is a page with a script to help you with this.

您可以使用 SP sp_helptext 查看所需存储过程的内容.

You may use the SP sp_helptext to see the contents of the required stored procedure.

这篇关于如何在 Powershell 中获取 SQL 存储过程的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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