开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜