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.
EXEC sp_HelpText '[ServerName].[DatabaseName].dbo.storedProcName'
thanks ahead.
Instead of invoking the sp_helptext locally with a remote argument, invoke it remotely with a local argument:
EXEC [ServerName].[DatabaseName].dbo.sp_HelpText 'storedProcName'
Little addition in answer if you have different user rather then dbo
then do like this.
EXEC [ServerName].[DatabaseName].dbo.sp_HelpText '[user].[storedProcName]'
It's the correct way to access linked DB:
EXEC [ServerName].[DatabaseName].dbo.sp_HelpText 'storedProcName'
But make sure to mention dbo
as it owns the sp_helptext
.