简体   繁体   中英

Share SQL login amongst multiple SQL Server Database projects in VS17

I have a single SQL Server with two databases which to update I use Visual studio SSDT projects.

Within my VS solution I have two SQL Database projects named Db_1 and Db_2. Db_2 has numerous tables populated with data. Inside of Db_1 I have created a view which selects data from Db_2.

The issue I am having within the solution is, how do I share the SQL Server login amongst both database projects so that the SQL Server login is mapped to more than one user.

I currently have the "CREATE LOGIN" (SQL Authentication) script in Db_1 project and Db_1 also has a reference to Db_2 to able to see the tables which the view uses.

When I add a reference from Db_2 to Db_1 in order to use the login to create the user which will give permission to select the table I get a circular reference.

Is it possible to share a SQL Server login amongst two sql database projects? Or should I be looking at this in a different way ?

Thanks.

Ok so I'm not sure if this is the best way of achieving the solution but as per above I have two projects. I have created a third project called common and then in the other two projects referenced the common project and moved the server logins in to there. Hope this helps. Would still be interested to know if there is a better way of doing this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM