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?
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