Accessing database on linked server
-
Sunday, January 20, 2013 4:02 PMHi all,
I have two databases. On seperate MS SQL Server.
So I linked database A to database B by performing sp_addlinkedserver['B'].
This works as i can list all the servers and its there using sp_linkedservers
I can the perform a command like
select * from B.master.sys.databases and it correctly shows all of the correct databases.
If I then go to do
select * from ['B'].database.dbo.table1
I get an error about an invalid object/object name. Whats wrong? I have tried adding square brackets around all parts and still the same?
All Replies
-
Sunday, January 20, 2013 4:13 PM
-
Sunday, January 20, 2013 4:38 PM
You don't need to give single quote around the names
try this
select * from [B].[database].[dbo].[table1]
Regards
satheesh- Proposed As Answer by Naomi NMicrosoft Community Contributor, Moderator Sunday, January 20, 2013 5:27 PM
- Marked As Answer by Iric WenModerator Monday, January 28, 2013 6:07 AM

