SQL 使用 sp_HelpText 查看链接服务器上的存储过程

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2953471/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 06:25:38  来源:igfitidea点击:

SQL using sp_HelpText to view a stored procedure on a linked server

sqlsql-servertsql

提问by stevenjmyu

Anyone have an idea about how to use sp_helptext to view a stored procedure on a linked server? basically something like this. I don't have the credentials to that linked server to look at it.

任何人都知道如何使用 sp_helptext 查看链接服务器上的存储过程?基本上是这样的。我没有该链接服务器的凭据来查看它。

EXEC sp_HelpText '[ServerName].[DatabaseName].dbo.storedProcName'

thanks ahead.

提前谢谢。

回答by Remus Rusanu

Instead of invoking the sp_helptext locally with a remote argument, invoke it remotely with a local argument:

不是使用远程参数在本地调用 sp_helptext,而是使用本地参数远程调用它:

EXEC  [ServerName].[DatabaseName].dbo.sp_HelpText 'storedProcName'

回答by sal

Little addition in answer if you have different user rather then dbothen do like this.

如果您有不同的用户,那么回答很少,dbo然后这样做。

EXEC  [ServerName].[DatabaseName].dbo.sp_HelpText '[user].[storedProcName]'

回答by Dev

It's the correct way to access linked DB:

这是访问链接数据库的正确方法:

EXEC  [ServerName].[DatabaseName].dbo.sp_HelpText 'storedProcName'

But make sure to mention dboas it owns the sp_helptext.

但请务必提及,dbo因为它拥有sp_helptext.