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]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.