x

How to add objects to existing VS2010 database project

We have a database project in Visual Studio 2010. On our development server, I have created a couple of new tables (with some indexes, foreign keys, etc).

How do I import this new table and associated indexes, keys etc into my database project?
more ▼

asked Feb 10, 2011 at 01:23 AM in Default

xnl28 gravatar image

xnl28
895 56 60 62

(comments are locked)
10|1200 characters needed characters left

2 answers: sort oldest

I am not too sure about VS2010 with regard to reading objects out the database, or how you have your project setup, but I have written a Powershell script to read out the objects of a database for use with source control. It spits out a file for each object, you would then only need to create the table files using the SMO calls in my script.

You can find the script here: [Scripting DB Objects using Powershell][1]

[1]: http://williamdurkin.wordpress.com/2010/10/20/scripting-db-objects-using-powershell/
more ▼

answered Feb 10, 2011 at 01:58 AM

WilliamD gravatar image

WilliamD
25.9k 17 19 41

An excellent script! Thanks
Feb 10, 2011 at 02:19 AM xnl28
(comments are locked)
10|1200 characters needed characters left
Visual Studio 2010 has the ability to compare a database with the project. It's in the Data menu and the Schema Comparison option. After that it should be fairly self-explanatory.
more ▼

answered Feb 10, 2011 at 04:57 AM

Grant Fritchey gravatar image

Grant Fritchey ♦♦
103k 19 21 74

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x244
x17
x1

asked: Feb 10, 2011 at 01:23 AM

Seen: 1827 times

Last Updated: Feb 10, 2011 at 01:31 AM