Database Schema Viewer functionality in vs2013 - visual-studio-2013

Recently migrated from vs 2010 -> vs 2013. Observed that there is no Database Schema Viewer in vs 2013 for DB projects. SQL Server Explorer does something similar but when you add new items (say a new table) to a project, noticed two things:
1. the new table file gets created in the root folder and not under the Schema Objects\Schemas\dbo\tables\
2. In vs2010, the table scripts used to have extension XX.table.sql but in vs2013, its always XX.sql
What actions can i take to achieve the above 2 behaviors as in vs 2010

Schema View is no longer part of Visual Studio. You'll have to use a 3rd party tool. If you have SQL Server Management Studio then you can use its database diagrams feature.
Visual Studio no longer manages the folder structure in database projects. When adding a new item, you should add it to the appropriate folder yourself.
To include the schema name in your files go to the database project's properties, select the Project Settings tab, and check Include schema name in file name. This change is not retroactive.

Related

How do I import the subset of a database into a visual studio 2013 project

I'm trying to upgrade a Visual Studio 2008 database project to a visual studio 2013 database project.
I've been getting an error like
[dbo].[trigger_name] has an unresolved reference to object [dbo].[table_name]
From what I've read here, it seems to say that you can import a subset of a database somehow:
SQL Server Database projects are meant to mirror fully the databases
to which their contents will be deployed. Although you can create
projects that contain just a subset of a database—for example, the
assets for a SQL CLR assembly—SSDT will block you as soon as any T-SQL
in the project references an object in the database that is not also
in your project.
Since I only need 10 tables for my script to run, how do I create these tables in my project, so that I no longer encounter the aforementioned error?
Or, is there a way to link to a database on a server and allow my triggers to verify the object against the actual database schema?
You can create a new db project then right click on it and choose Import database. In
the Import wizard you will choose which table you want to be imported.
Once you have it imported then go to your actual database project and add database reference which will point to the newly created project.
Second method is to add those 10 tables to your existing project. Right click on the project name and choose Schema Compare. Set your project as a target and Sql Server database as a source, click Compare, choose your tables and click Update target.
You can't add a reference to sql server directly.

Lightswitch 2013 linked SQL Database Project disabled

OK, after lots of searching I've boiled this down to an extremely simple repro and am very confused. I have VS 2013, all updates, etc.
Create new HTML Lightswitch app, creates 3 projects.
Add new database project to solution
Go to Lightswitch properties (of "common" project)
Result: SQL Database Project drop down is disabled and set to .
Expected: My new db project to be listed for me to link.
You must create at least one table in the Intrinsic Database before you can choose an SQL Database Project to link to your LightSwitch Project. That is, right-click "Data Sources" and choose "Add Table".
From http://blogs.msdn.com/b/lightswitch/archive/2013/07/03/intrinsic-database-management-with-database-projects-chris-rummel.aspx:
The last step to using the database project is to let LightSwitch know
about it. Open the LightSwitch project properties and select your
database project.
Note that you won’t be able to select a database project if you don’t
have any intrinsic tables, so if you’re trying this out in a new
project you’ll have to create a table first.

Visual Studio Project that execute an SQL script

I have this question... probably is similar to Executing scripts from a database project in visual studio
but i didn't understand the solution given.
So i made a Database Server 2008 project inside visual studio.
Just one table. When i press DEPLOY the database is created inside SQLServer2008 and the table is created.
Now what if i would like to give the project to someone who has SQLServer and he needs to recreate the database and the table in his computer?..
Apart form executing the query from Visual Studio is there any way to create an executable that automatically "deploy" from outside Visual Studio?..
Thanks,
There are different types of Database projects in Visual Studio. The old ones, which were not so feature rich. The 'Data Dude' ones that came with Visual Studio 2010 Team Database Edition and the most recent iteration that comes with the SQL Server Data Tools. All of these can be installed on top of the standard Visual Studio Professional and don't require additional licenses.
SQL Server Data Tools is the latest, and also the best integrated and most powerful variant of the bunch. It can also be used to compare existing schema's and generate upgrade scripts or automatically upgrade the schema in an existing database for you.
During build, a package will be created that holds all the schema information for your database. You can then use the command line tools provided by the SQL Server data tools or MSDeploy to deploy your compressed schema file to a new or an existing database.
This deployment mechanism can also upgrade existing schema if needed.

Schema Compare Visual Studio 2010 - adding new object do database project to main directory

During conversion old, 2008 database project into 2010 database project using features like Partial Project reference, I encounter problem with Schema Compare in VS 2010. After successful merge new object from DB into DB project, files are being added into the root directory of database project, but it should be added into to existing Schema Objects structure.
Any ideas, how solve this problem?
I have used simple workaround: creating project from scrach, attach all partial projects and merge all objects from DB into DB proj - same effect can be acquired by manual creation of the .dbproj file.
It is high probability, that it was configuration issue located in .dbproj file and was caused by upgrade DB proj from VS 9 -> V10.

Database in version control using Visual Studio 2010 Professional

I've added a SQL Server 2008 database project to my Visual Studio 2010 Professional Edition solution in the hope that it might allow me to include my database in version control.
I can commit the schema files for each database object into version control, however these schema files all script objects as create rather than alter, so are not good for colleges getting my changes and updating their databases.
Is this a good way to get my database into source control?
And what would the workflow be for actually using it to update databases to a given revision without losing all the data associated with dropping and re-creating all the tables?
Update: on Premium and Ultimate versions, there is a schema compare tool which makes this easy. This does not exist on Professional. Is there any straightforward manual workaround?
I'm not sure if you can do this in VS 2010 Professional, but in VS 2010 Premium, you can do a schema comparison (Data -> Schema Compare -> New Schema Comparison) between your project and database, and update changes in either direction.
When going from project to database, VS generates a script that copies existing data into a temporary table before dropping the existing one.
The database project has a deploy step (which is present in my Professional copy of VS2010) that will generate a sql script with your sql objects in it.
The key thing here is if you r-click the project, properties, goto deploy and change target database settings to a specific database, when you deploy it will generate a change script for that specific database so it matches the objects in the project (and in theory keep existing data etc).
You can get it to either generate a sql script, or directly update the database. Generating a script is probably a better idea :)

Resources