1

I'm trying 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?

Raymond Morphy
  • 2,464
  • 9
  • 51
  • 93

1 Answers1

1

You would need to use dynamic TSQL.

Please read: The Curse and Blessings of Dynamic SQL

Mitch Wheat
  • 295,962
  • 43
  • 465
  • 541