Database provider: accessing schemas other than dbo in SQL Server?
Author: adrian50697
Creation Date: 10/20/2015 5:54 AM
profile picture

adrian50697

#1
I have successfully connected to my SQL Server db via the database provider (System.Data.SqlClient) - however I cannot access any tables other than those in the "dbo" schema.
An example is - my data lives in the hist.data table but I cannot access it unless I change it to dbo.data.

Is there any way to specify the schema so that I can access my non-dbo schema tables?
profile picture

Eugene

#2
The provider uses whatever connection string you passed it. However, my understanding is that selecting a different schema can't be accomplished with the connection string but rather has to be done at the user level with ALTER USER clause:

Possible to set default schema from connection string?
profile picture

adrian50697

#3
I've already tried and this does not work.
profile picture

Eugene

#4
What exactly does not work, an ALTER USER clause?

Have you also tried the Initial Catalog switch?
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).