DacFx icon indicating copy to clipboard operation
DacFx copied to clipboard

sqlpackage option to exclude specific tables from export

Open dzsquared opened this issue 2 years ago • 4 comments
trafficstars

https://github.com/MicrosoftDocs/sql-docs/issues/8511

is there a way to exclude certain tables? the /p: TableData=(STRING[]) option can include tables. is there an inverse to only exclude certain tables? this is possible in SSMS advanced settings when using the export data tier application wizard. looking for a way to script it, cross-platform, using sqlpackage

dzsquared avatar Feb 28 '23 00:02 dzsquared

is sqlpackage open source? maybe i can contribute a solution

ci-vamp avatar Feb 28 '23 01:02 ci-vamp

I second this one - I'd also be happy to help out if this is open source. I would additionally love it if there was a way to ignore the data in a table, but include the table definition

hugoforte avatar Nov 03 '23 12:11 hugoforte

In the meantime I wrote a Powershell script that achieves the same thing; https://gist.github.com/jhelmink/b579ae0e1494b9b4ef497311c8a11754

It just queries your database for all the base tables, excluding any you don't want, and creates a set of /p: TableName=xxx that are appended to the SqlPackage /Action:Extract command.

This gets you the full schema of all tables, but only the data that you want.

jhelmink avatar Apr 06 '24 22:04 jhelmink

Would be really interested in this feature too!

Frankkkkk avatar Apr 30 '24 09:04 Frankkkkk