Shared Database SaaS - DataAccess Layer


approach i

we implementing saas shared database. having following schemas

dbo.tbl_users

client1.tbl_users

client2.tbl_users

dynamic connection string : datasource:local; userid=client1user password=client1pwd (we had created login user in database default schema client1.

but though code , connecting dbo.tbl_users. instead of client1.tbl_users.

approach ii

we can add dynamically schema name based on client. in these case , need changes entire application.

is possible approach i

 

hi,

if object (including tables, view , ect.) without explicit schema name specified in query, object located searching default schema , dbo schema.

in approach 1, if connect sql server using login client1 default schema client1, query should use client1.tbl_users in case. please make sure make connection using correct login, , default schema configured.

fore more information, see how refer objects section in http://msdn.microsoft.com/en-us/library/dd283095(v=sql.100).aspx.


best regards
alex feng | forum support

please remember mark replies answers if , unmark them if provide no help. if have feedback technet subscriber support, contact tnmff@microsoft.com.


SQL Server  >  SQL Server Data Access



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........