How To Create Database Project In Visual Studio 2015

Getting Started

  • Open Visual Studio 2015 and create a new project.
  • Go to "File" -> "New" -> "Project".
  • Select "SQL Server" in the installed templates.
  • Select "SQL Server Database Project".
  • Enter the Name and choose the location.
  • Click "OK"


Figure 1

Next thing is you need to right click on solutions and click Add. Here you can add many things like Table, View, Script, Stored Procedure, table valued function, Scaler valued function, etc.


Figure 2

Once you click on create new Table, that gives you a bunch of options there in Tables and Views template. Give proper table name and click Add button.


Figure 3

Once you done with adding table, you will see the following design like, here you can add columns with datatype.


Figure 4

This is my table script.


Figure 5

Publish The Database

Right click on solutions explorer and click on properties.

You can select SQL server version from Project Settings tab.


Figure 6

Now you can change default connection from Debug Tab. Click Edit button.


Figure 7

Now change connection properties and enter server name, user name, password and select database and click OK.


Figure 8

Don’t forget to save changes.

Now right click on solutions and click Publish.


Figure 9

Edit target database setting.


Figure 10

Enter connection properties and click OK.


Figure 11

And now click on Publish button.


Figure 12

Wait until database published.


Figure 13

Once you see published completed successfully. Now connect SQL Server Management Studio and check database.


Figure 14

Summary

In this article you learnt how to create database project in Visual Studio 2015 and publish that database in SQL Server 2014. If you have any question drop me a line in comments section.


Similar Articles