Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
khanewal
Starting Member
33 Posts |
Posted - 2010-09-20 : 19:45:10
|
Declare @DBname AS varchar(25),@LinkedServer AS Varchar(25)SET @DBname = 'ABC'SET @LinkedServer = 'ServerVM01'Select * from [@LinkedServer].[@DBname].[EDDSDBO].[File]Why I can't use Variable in a link server query getting an error, Msg 7314, Level 16, State 1, Line 11The OLE DB provider "SQLNCLI" for linked server "ELAWRELSQLVM01" does not contain the table ""@DBname"."EDDSDBO"."File"". The table either does not exist or the current user does not have permissions on that table. |
|
X002548
Not Just a Number
15586 Posts |
|
khanewal
Starting Member
33 Posts |
Posted - 2010-09-20 : 21:57:28
|
No, just store the DB into the variable so that whenever Store proc runs change the DB name and insert values into the particular project, it will easy to store DB name in a variable |
 |
|
|
|
|