Sql-server – Database structure

database-designsql server

I've been searching for a while how to solve this problem, and finally I've decided that maybe it's better to ask for some help.

We have two different application (app1 and app2), each of them with a different database (db1 and db2). Then we have another project to manage those applications data using both databases. This would be app3 with db1 and db2.

In db1 we have a clients table to set which client have active which application. Exemple: client 1 has active app1, client 2 have active app1 and app2, and so on… this is managed from app3.

The problem is that in app2 we need to access to this table in db1 to know if the user has that application active to log in.

We were thinking to separete this table in another database, but as we are not database experts we are wondering if there is any other better solution to solve this.

It's possible that in the future will exists a forth application with same clients and different database so we'll have the same problem. And duplicate clients it's not an option.

We're using SQL Server and .NET Core.

Thanks

Best Answer

It is possible to query across multiple databases in SQL Server if all the databases are on the same instance, or there are linked servers set up between them. The login would need access to all the databases.

For your design question, I think having a third database for the separate concern of the client connections makes sense. This would allow the apps to focus on their specific data requirements in their databases and the client connections requirement focus on just that without crossing domains too much.