[英]How to get the definition of a stored procedure in a Linked Server?
I need to get the definition of a stored procedure, from another different server.我需要从另一个不同的服务器获取存储过程的定义。 When I want to see the definition locally, I can do something like:
当我想在本地查看定义时,我可以这样做:
SELECT TOP 1 *
FROM sysobjects
WHERE name = 'procedure_name'
When I want to see how this same stored procedure is currently, I tried to do this, since it's on a linked server:当我想查看当前相同的存储过程时,我尝试这样做,因为它位于链接服务器上:
SELECT TOP 1 *
FROM [xxx.xx.xxx.xx].DBName.dbo.sysobjects
WHERE name = 'procedure_name'
It runs okay, no error, but I get the definition of my local procedure, not the one on the remote server.它运行正常,没有错误,但我得到了本地过程的定义,而不是远程服务器上的定义。 Is there a way to do this?
有没有办法做到这一点? I couldn't seem to find any information about this case.
我似乎无法找到有关此案例的任何信息。
You might try:你可以试试:
EXECUTE
(
'
SELECT
OBJECT_DEFINITION(
OBJECT_ID(N''dbo.ProcName'', ''P''))
'
) AT [LinkedServer]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.