DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Data Engineering
  3. Databases
  4. Visual Studio 2012 Schema Comparison

Visual Studio 2012 Schema Comparison

Nick Haslam user avatar by
Nick Haslam
·
Aug. 20, 12 · Interview
Like (0)
Save
Tweet
Share
15.70K Views

Join the DZone community and get the full member experience.

Join For Free

having recently been playing with the newly released visual studio 2012, one of the really nice features that i’ve seen is the database schema comparison functionality.

if you’d like to follow along with this, you’ll need the contosobi database, which is available here .

this can be seen by launching vs2012, choosing new project, and selecting the sql server database project. don’t forget to give the project a name, i called mine dbschemacomparison.

image

when the solution has been created, you’ll be presented with the solution explorer.

image

in here, you’ll want to right-click on the project name, and choose import > database. in here, you’ll need to create a new connection to your database. also, if you are wanting to track everything, you need to check the permissions and database settings tick boxes. then click start.

image

while the process is running, you’ll be presented with a dialog box showing the progress. when it’s completed, click finish.

image

now, when you look in the solution explorer, you’ll see a set of sql scripts that have been created to match the structure in the database.

image

my next step was to connect to the database using sql server management studio, and alter one of the tables. i decided to add an index to the dimaccount table. the index was called ix_date, and i added the loaddate field from the dimaccount table to it.

image

the final step in this process is to go back into visual studio, right click on the project and choose schema compare. when this window opens, you have two drop down boxes. the left contains the project that you have in vs2012; the right will need to be populated with a database for comparison.

image

when you’ve populated the database on the right, click the compare button. the schemas from the two projects are loaded and compared. the results are then displayed on the screen. as can be seen below, it’s pretty obvious what the differences between the environments are.

image

if you then want to sync the environments, you need to remember that you need to move the changes from source (left) to target (right). if you want to remove them from the right (database), then you can click update (or the script button next to it, to generate a script). alternatively, if you want to update your project, you can click the ‘switch’ button between the two projects and rerun the compare.

a really nice feature, i think you’ll agree.

Schema Comparison (grammar) Database

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • How To Validate Three Common Document Types in Python
  • Distributed Stateful Edge Platforms
  • Best Practices for Writing Clean and Maintainable Code
  • The Top 3 Challenges Facing Engineering Leaders Today—And How to Overcome Them

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: