database-projectdata-tier-applicationsbacpacdacpac

Can I import BACPAC with data into DB project?


I have a database with data that I want to turn into a Visual Studio 2012 SQL Database project.

I tried using "Import->Data-tier application (*.dacpac)..." - I get no errors but no data gets imported (and there is no option to include data).

How can I include data with BACPAC import?


Solution

  • I don't think that you'll be able to include data in this manner. The bacpac format is to seed your target database with schema + data. When you're using the normal SQL DB Projects, you need to use Pre and Post Deployment scripts to handle data manipulation. If you're trying to load a lot of data into a new database, you might even be better off storing those outside of the project and calling that population in a script that runs only after a new database is created.

    If you're trying to generate the data for that initial load, there are several good tools you can use. VS 2010 DB Projects had a Data Compare option that you could use to compare a populated database against a new database. Red-Gate has SQL Data Compare. I think SSMS Toolspack from Mladen Prajic also adds a "generate data" command.