I'm trying to figure out how to call SP on server A from within a SP on server B.So far I have this:CREATE PROCEDURE [dbo].[p_upd_lim_tr]( @lim_id varchar(30), @lim_low_num int, @lim_hgh_num int) ASSET NOCOUNT ONdeclare @sql_qry varchar(1000)set @sql_qry = '''[someDB].[dbo].p_upd_lim ''' + cast(@lim_low_num as varchar) + ', ' + cast(@lim_hgh_num as varchar) + ''''''print @sql_qryEXEC ('SELECT * FROM OPENQUERY([LNKDSRVR],' + @sql_qry + ')')-- rest omitted
For sample parameters I'm using, @sql_qry is printed as:'[someDB].[dbo].p_upd_lim '120, 140''
So perhaps it's not really surprising that it doesn't work - but I tried various combinations of quotes, with no success. How should this string be formatted for it to work? Or is there some other way of running an SP from remote (linked) server and passing parameters to it?Thanks!