Use non-standard db-schema in multi-db queries via linked server

Hi everyone.

I have
1. Server 'Logs' with DB 'WebLogs' in which there is only one table WebLogs with fields UserId, URL
2. Server 'Main' with DB 'MyProject' in which there is a table with specific db-schema 'ololo.Users' with fields Id, MobilePhone

I've created linked server connection according to msdn-man → https://msdn.microsoft.com/en-us/library/ms190479.aspx

Then I created linked-server connection in linqPad.
Everything was awesome while i was writing query — linqPad got all data about linked db tables.
All I need Is to get data from weblogs by user.MobilePhone


On F5-Run I've got a message
The OLE DB provider "SQLNCLI11" for linked server 'Main' does not contain the table 'MyProject.dbo.Users'. The table either does not exist or the current user does not have permissions on that table.


So the problem is linqPad can see the table with non-standard schema on linked server, but on querying the one it uses standard MS SQL schema 'dbo' instead of real one.

And there is no such hack as MyProject.Ololo_Users and Raw SQL query doesn't work either.
So. Is there any solution for this?

Comments

  • Did you ever figure this out? I had the same issue where I had three databases, two that used the typical dbo schema and one that didn't. I got the same error as you but I was able to make the non-standard schema the main database and the others the link servers and it worked for me.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!