Hi,
I have two database in different servers and i need to access one db object in another db. for ex, server1 (db1) and server2(db2(tableA,tableB) )
I will be writing a stored procedure in in db1 and i wanted to access the TableA's data of db2. i am aware of using the linked server. but i am, looking for alternate for linked server because i need to pass credentials at runtime to connect the server and
access the objects.
Ex:
Create Procedure Test(@server varchar(50),@username varchar(20), @pwd varchar(20)) as Begin select * from server2.db2.tableA; End
the alternate i found is OpenQuery. not sure how should i accomplish using openquery and am not sure about the drawback of using this. please suggest me the best way to achieve this and if possible show me some sample.
Thanks in advance
loving dotnet