Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2012 SQL Database Project with SSDT

I'm starting to use Visual Studio 2012 with integrated SQL Server Data Tools and although I watched 2 of microsoft's video's on getting started with SQL Database Projects I'm still having trouble understanding how to work with them especially since I'm new to db development.

Some questions:

  1. What is the difference between Importing a database or adding a reference to the database?

  2. What is the difference between Server Explorer and SQL Server Object Explorer tabs? In one I can browse the database through localhost\SQLEXPRESS.dbname and the other goes through localdb\Projects. At what point are these synchronized?

  3. How do I change the Target Database Name under the Project's properties?

like image 442
parliament Avatar asked Sep 11 '12 18:09

parliament


People also ask

Which version of SSDT is compatible with SQL Server 2012?

SQL Server 2012 - Visual Studio 2010 (SSDT, available on SQL Server installation media) or Visual Studio 2012 (SSDT-BI, available as a separate download)

How do I create an Ssdt project in Visual Studio?

Click File, New, then Project. In the New Project dialog box, select SQL Server in the left pane. Notice that there is only one type of database project: the SQL Server Database Project. There is no platform-specific project as in previous versions of Visual Studio.

How do I run a SQL project in Visual Studio?

Launch Visual Studio and select Create a new project. Search for database and select SQL Server Database Project. Click Next. Enter the name of the project.


2 Answers

1) Importing a data base creates a project that includes all of the databases artifacts. Adding a database as a reference allows a project to access the database. So if you have a SSDT project and a c# project that uses the db, the c# project gets the reference. You could choose to create the SSDT project by importing an existing db.

2) SQL Server Object Explorer is part of SSDT and allows you do perform online SQL development including creating new artifacts, adding data to tables, and executing scripts.

3) To change the target database name for debugging purposed (where the database goes when you build/debug) change the target connection string in the debug tab of the properties menu of the project.

I've found this link to be quite helpful.

like image 101
Andrew Clear Avatar answered Sep 27 '22 23:09

Andrew Clear


There are many differences between SQL Server Object Explorer (SSOX) and Server Explorer. Here's a couple: SSOX allows you to launch refactoring operations SSOX provides a logical view of your source code in Solution Explorer

In short, SSOX targets database development whereas Server Explorer is (I think) a generic hierarchical viewer for many server types.

Regards Jamiet

like image 45
jamiet Avatar answered Sep 27 '22 22:09

jamiet