I want to create several dacpacs from a single database but each from different schema or group of objects. Is it possible to do this with T-SQL?
I have to create a system to distribute database structures among different locations and I need to do this via T-SQL?
Or if anybody has any idea or experience in this field I would appreciate it.
There is no SQL command to create a BACPAC file.
The utility responsible for creating these files is called SqlPackage.exe.
To only copy data for specific schemas, you will need to explicitly list these tables in the command arguments. See: https://www.mssqltips.com/sqlservertip/5052/restore-individual-tables-using-sql-server-bacpac/
Disclaimer: It is possible to run these commands from within SQL Server using
xp_cmdshell
but I would not recommend it.