Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import data into Visual Studio 2012 Sql Server Database Project

I'm looking at using Sql Server Database projects. It appears to import schema and stored procedures from a database, but there's no mechanism to import actual data. As part of our build process, we usually import both schema and data.

Can this be done from Sql Server Database projects?

like image 539
Doug Avatar asked Dec 19 '12 22:12

Doug


People also ask

How do I import a database into SQL Server Management Studio 2012?

In SQL Server Management Studio, enter details, click Connect, right-click the database, and click Import Data. To import, select Import Data > Next > Excel > Browse, open the file, and follow the steps to import data from the file.

How does Visual Studio connect to database project?

On the View menu, select Other Windows > Data Sources. In the Data Sources window, click Add New Data Source. The Data Source Configuration Wizard opens. Select Database on the Choose a Data Source Type page, and then select Next.


1 Answers

The current solution is to place reference data use a post-deployment script. The script must be written to be idempotent as it has no knowledge of the state of the target. This is described in detail here:

Including Data in a SQL Server Database Project

like image 197
David Atkinson Avatar answered Nov 15 '22 09:11

David Atkinson