Search code examples
sql-serversql-server-data-toolsdacpacsqlpackage

Is there a way to create migration script for a single or a selected group of objects with SqlPackage?


I'm trying to migrate specific objects from one database to another using sqlpackage.exe /action:Extract and sqlpackage.exe /action:Script. Currently I'm creating the script and filtering the unneeded objects manually, I would like to be able to exclude them all together and to automate the process. So far I didn't find in the documentation any option that does it.
Thanks.


Solution

  • There is no way to remove single objects with native functionality. Natively you can remove only specific object types.

    You can write your own deployment contributor and then skip whatever objects you need. Here is an example here.

    Check Ed Elliot's ready to use contributor with bunch of configuration options (I haven't used it for a while and do not know how does it work with the new versions of SQL Server).

    Additionally, in Ed Elliot's blog you can find a lot of useful information.