How to send a linked server name as a parameter of stored procedure?
I'm tryin开发者_开发百科g to create a simple stored procedure which queries with Linked server.
create procedure test
@LinkedServeName nvarchar(20)
as
begin
select * from @LinkedServerName.WorkersDB.tbl_workers
end
What's the solution?
You would need to use dynamic TSQL.
Please read: The Curse and Blessings of Dynamic SQL
精彩评论