Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to call stored procedure from another server i have following stored procedure.

What I have tried:

SQL
declare @fileNo nvarchar(20);
declare	 @OutPutmessage nvarchar(150);
set @fileNo='sl3193';
set @OutPutmessage=null;

SELECT spresults.* 
FROM OPENROWSET('SQLNCLI', 'server=xxx.yyy.xx.xx;Uid=username;Pwd=passwoord;

database=[dbName];

Persist Security Info=False',
                'EXEC [AlahliX].dbo.[ELStudentsDet] @Regno= sl3193,@message=null') AS spresults


when I am passing static value to @RegNo & @message its working fine but I want to take the dynamic value so how I can pass dynamic values.
Posted
Updated 20-Jan-20 18:16pm
v2
Comments
_Asif_ 21-Jan-20 2:40am    
Why can't you try this?

https://stackoverflow.com/questions/13831472/using-a-variable-in-openrowset-query

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900