1.How to create a dacpac file for the specific objects? 2. How to exclude specific objects from the dacpac.

Munshi, Akshay-XT 1 Reputation point
2021-06-24T10:15:56.54+00:00

Could you please guide us with the below two points:

  1. How to create a dacpac file for the specific objects.
    e.g.: We are having 1000 tables in our source database and from those 1000 tables we need to create dacpac for only 50 tables.
  2. How to exclude specific objects from the dacpac.
    e.g.: We are having a dacpac file in that 1000 tables are available and we need to deploy or publish only 50 tables to the target database.
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,697 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Olaf Helper 40,741 Reputation points
    2021-06-24T11:29:58.89+00:00

    You can not, a DACPAC always presents the complete database, not single objects.
    See Data-tier Applications: A data-tier application (DAC) is a logical database management entity that defines all of the SQL Server objects

    Use the script wizard instead to script out single objects.
    Generate Scripts (SQL Server Management Studio)

    0 comments No comments

  2. Tom Phillips 17,716 Reputation points
    2021-06-24T17:56:51.257+00:00

    A dacpac represents an entire database from a project file. When you PUBLISH a dacpac, as a default it only changes objects which are different. If the objects are the same, they are skipped.

    0 comments No comments

  3. AmeliaGu-MSFT 13,961 Reputation points Microsoft Vendor
    2021-06-25T03:17:06.387+00:00

    Hi MunshiAKshayXT-4232,

    Welcome to Microsoft Q&A.
    Agree with others. In addition, if you only want to import and export specific tables, you can create a .bacpac file, which can specify a subset of the tables to be exported. The export-import operations can be combined to migrate a DAC between instances, to create an archive, or to create an on-premise copy of a database deployed in SQL Database.
    Please refer to Export a Data-tier Application and Import a BACPAC File which might help.

    Best Regards,
    Amelia


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments