Sql-server – How To Merge Database Projects on Visual Studio 2013

database-projectssql servervisual-studio-2013

Can I have multiple database projects to the same SQL Server database? Like, one main project referencing multiple subprojects.

I have an application with multiple modules and each module has its own database structure living in a schema.

I want to reuse the modules in another application, for example, the security module, which has the user, roles, groups, etc.

I want to know if there is a way I can define those schemas and all of its objects (tables, stored procedures, indexes, views, etc) in one database project and then reference this "base" database project in the database project of the actual application.

Best Answer

Certainly appears you can do that in Visual Studio 2012. I just created a Database Project "database1", then added another database project to the same Solution, named "database2".

I then right-clicked the "Database1" project, clicked "Add Database Reference" and selected the "Database2" project. Then, under "Database Location" I chose "Same Database".

enter image description here