Working with Openrowset
I am Working with OPENROWSET in my application.Its working fine while i am writing it as a query by suppling directly the servername,userid,pwd.But every time I can not hard code the values directly..So I want to write it as a storeprocedure by supplying all these values as input parameters,but its giving error while doing like that .So I want to know how to write it in a storedprocedure and what is the differece between the usage of linkedserver and openrowset.Here is my working query
USE MyDB
GO
SELECT a.*
FROM OPENROWSET('SQLOLEDB','MySErver';'USerID';'PWD',
'SELECT * FROM MyDB.dbo.MyTable ') AS a
GO
Thanks in advance.