Sql-server – Export sql azure DB as bacpac file without including data for certain tables

azure-sql-databasebackupdata-tier-applicationsql server

When I export a sql azure database as data tier application from sql server management studio I get the option to tick off certain tables but then these tables are not included in the resulting file.

I want to export these tables schemas, but ignore their data (import empty tables essentially). For all the other tables I also want the data.

Is it possible to do that?

Best Answer

You can create a perfect copy of a table and the whole schema by doing:

SELECT TOP 0 * INTO new_table FROM old_table

If you have a linked server or a database on the same server that is called, let's say, database_copy you can actually iterate all tables and you will end up having the same number of tables, all with the same schema.

Otherwise, if you can mask the data or encrypt them. But in this case they will still be on the database