I need to execute a procedure from the linked server using an openquery()
create procedure test(@ip varchar(10),@op varchar(10) output)
as
begin
if @ip='a'
begin
set @op='Success'
end
end
if suppose the procedure is like above and i need to return the o/p of @op variable by passing i/p as @ip variable
the SP is successfully executed with this code, but need to run using openquery().
declare @op varchar(10)
execute <servername>.<dbname>.dbo.test 'a',@op OUTPUT
select @op
how to pass o/p parameter to openquery
select * from openquery (<servername>,'execute <dbname>.dbo.<sp_name>')
//like this we can run a procedure who don't have any parameter