The other day I found myself looking at how I can include reference data in a new database as part of my SQL Server Database Project. Typically for my existing databases, I’ve just create post-deployment scripts to add/update/delete reference data as needed with each release. However with my new database, I have a number of tables and rows in each that I’ll need to deploy the first time.

The first option that comes to mind would be that I can do this as per usual and create a v1.0 script to populate the data, but I thought there should be a better way to maintain and deploy this data. What if it ever changes and I need it updated? I’ll then have to script specific post-deployment scripts. Not ideal.

I did a little searching and came across this old post on the SQL Server Data Tools Team Blog for Including Data in SQL Server Database Projects. This seems like a great option, but I already see there are a number of people complaining that this isn’t good enough and I would agree. I also have the added annoyance that I’m still stuck using SQL Server 2005, so the MERGE option isn’t even an option for me.

Further research shows another post on how to Mimic MERGE with the OUTPUT statement in SQL Server 2005. This looks like it will work for SQL Server 2005, but makes things more complex in my opinion. I really just want to declare in my database project the values the table should have on deployment and then let the build and deployment process determine what needs to be done.

I think for now I’ll stick with my first option and create an initial v1.0 post-deployment script. I’ll then take a look at what comes in Visual Studio 2013 later this year and if there are new options for addressing this issue.

We are moving to SQL Server 2012 by year end, so I can at least migrate to doing the MERGE approach at that time if there is nothing else available.

I hope this helps others in the same situation.

Enjoy!

This week we saw another update to the SQL Server Data Tools (SSDT). This release introduces several new features.

What’s New

  • Data Compare
  • Extensibility
  • Build and Deployment Contributors
  • Schema Model Navigation and Extensibility API
  • Updated Date-Tier Application Framework

Download it Now

http://msdn.microsoft.com/en-us/data/hh297027

References

http://blogs.msdn.com/b/ssdt/archive/2013/06/24/announcing-sql-server-data-tools-june-2013.aspx

Great post on doing connected database development with SQL Server Data Tools (SSDT). Please see my previous post on getting started with SSDT.

Read more…

Enjoy!

Great post on getting started with SQL Server Data Tools.

Read more…

Enjoy!

New updates are now available for SQL Server Data Tools (SSDT). The latest update is called SQL Server Data Tools – December 2012. You can get the update from here:

SSDT for Visual Studio 2012: http://msdn.microsoft.com/en-us/jj650015

SSDT for Visual Studio 2010: http://msdn.microsoft.com/en-us/jj650014

As posted on the following blog post, here is a recap of what’s new:

“What’s New?
Database Unit Testing

We have received an overwhelming amount of feedback that database unit testing is a critical feature for customers, so SSDT- December 2012 adds support for this feature. Database Unit Testing in SSDT will look familiar to many of you as it is based on the equivalent capability in the Visual Studio 2010 DB Pro tools. Some highlights:

  • Installs in Visual Studio 2010 or Visual Studio 2012:
    • Requires Visual Studio Professional or higher edition to support database unit testing functionality.
    • Installs side-by-side with existing Visual Studio 2010 DB Pro tools in Visual Studio Premium and Ultimate editions.
  • Supports client-side testing based on MSTest with the same built-in test conditions as DB Pro.
  • Allows desktop development and execution of tests as well as execution from the command line or as part of a build on a build server.
  • Upgrades existing VS 2010 test projects without change to the database unit test scripts or code.
  • Integrates with SSDT SQL Server database projects:
    • Automates deployment of the database project on test initialization.
    • Generates skeleton test scripts for stored procedures, functions and triggers via SQL Server Object Explorer.
    • Applies changes to test scripts when refactoring objects in database projects.
  • Supports custom test conditions (existing custom test conditions need to be modified before they can be used).

Stay tuned for a follow-up post on getting started with SQL Server database unit testing.

Integration of SSDT Power Tools

The SSDT team started releasing SSDT Power Tools last April as a mechanism to deliver new and experimental features with each release. Since then, the Power Tools have been downloaded over 24,500 times.

We received a great deal of positive feedback on the Power Tools and as a response, this release integrates the functionality previously delivered via Power Tools into the core SSDT product. The advantage of product inclusion is that a separate install will no longer be needed and that features are now fully supported and available to users in all languages. The following features are now included in SSDT’s SQL Server Object Explorer:

Projects node adds the equivalent of Schema View to SSDT. You can use this node to browse the logical schema of your project and to edit, refactor, and add new objects.

Script As support in SSOX enables you to generate Create, Alter, Drop, and Drop and Create-To scripts for objects in your connected database.

DAC actions allow you to perform similar DAC-based tasks in SSDT to those available in SSMS. You can extract a dacpac from a live database, publish a dacpac to a database, register a database as a DAC, or remove the registration metadata for a database registered as a DAC. These actions are supported for both on-premises SQL Server databases as well as Windows Azure SQL Databases.

clip_image003

We recommend that you uninstall the SSDT Power Tools extension if you had it previously installed.

Updated Data-Tier Application Framework

This release includes the November 2012 release of SQL Server Data-Tier Application Framework (DACFx), which contains several feature enhancements and bug fixes. You can learn more about the latest release of DACFx here.

Bug fixes

SSDT – December 2012 contains over 50 bug fixes, including fixes for customer-reported issues from SSDT – November 2012 and SSDT Power Tools releases.”

New updates are now available for SQL Server Data Tools (SSDT). The latest update is called SQL Server Data Tools – September 2012. You can get the update from here:

SSDT for Visual Studio 2012: http://msdn.microsoft.com/en-us/jj650015

SSDT for Visual Studio 2010: http://msdn.microsoft.com/en-us/jj650014

As posted on the following blog post, here is a recap of what’s new:

“What’s New?

Visual Studio 2012

In keeping with our goal of supporting the most recent version of Visual Studio, this release of SSDT supports the Visual Studio 2012 shell. SSDT – September 2012 contains several bug fixes to the SSDT version that shipped in Visual Studio 2012 and this release can be applied as an update on top of Visual Studio 2012 Professional, Premium, and Ultimate Editions. If one of these SKUs is not present on the box, running the SSDT installer for Visual Studio 2012 will lay down a standalone version of SSDT for the Visual Studio 2012 Integrated Shell.

Keep in mind that the underlying engine and functionality for SSDT – September 2012 is the same for both Visual Studio 2010 and Visual Studio 2012, so you don’t need to upgrade to Visual Studio 2012 to use the latest version of SSDT. If you wish to have both shells of SSDT in your environment, they can exist side by side and SSDT projects will successfully round-trip between both shells.

LocalDB Configuration Improvements

We received feedback that SSDT’s policy of creating a new localdb instance for each SSDT solution was too verbose, so we created a single localdb instance called Projects to host all the project debug databases. We’ve also enhanced SQL Server Object Explorer by surfacing the default localdb instance and enabling the deletion of localdb instances.

Support for ANSI_NULLS and QUOTED_IDENIFIER Properties

In previous releases, SSDT didn’t support database objects with non-standard ANSI_NULLS or QUOTED_IDENTIFIER properties. SSDT – September 2012 has enabled this scenario by adding support for ANSI_NULLS and QUOTED_IDENTIFIER properties on project and script files.

Updated Data-Tier Application Framework

SSDT – September 2012 includes the latest redist of SQL Server Data-Tier Application Framework (DACFx), which contains several feature enhancements and bug fixes. Most notably, the updated DACFx version enables packaging and deploying data using SqlPackage.exe. You can learn more about the new DACFx release here.

Updated SSDT Power Tools

The September 2012 update is compatible with updated Power Tools that include new features and support for both Visual Studio 2012 and Visual Studio 2010 shells.

SSDT Power Tools for Visual Studio 2012

SSDT Power Tools for Visual Studio 2010

Bug fixes to customer-reported issues

This release includes many bug fixes for issues reported by customers using SSDT RTW or Visual Studio 2012 RTM. Here are some of the most impactful bugs that this release addresses:

· Unable to override Publish Profile properties when using the msbuild command line

· Slow performance on "Add New Item" from SSDT project

· Absence of debugger functionality due to errors in assembly registration

· Publish fails with no message when "extended verification" is disabled

· SSDT overwrites Visual Studio shortcut on Windows8

· Steps to edit and save a Publish Profile editor aren’t intuitive”

Schema Compare is an incredibly useful tool, providing a visual head over SSDT’s model differencing and update engine. It can be used to compare any combination of database, project or dacpac, and allows selective update of the target schema (via an update script in the case of a dacpac). We’ve made some significant changes to the tool for the RTW release, improving its look and feel, particularly to make it easier to digest and process comparison results. This post describes many of Schema Compare’s key features – some of which surfaced in CTP4 – with a screen shot at the bottom that highlights several of them.

First, the visual comparison ‘language’ of the results grid:

Differences-Only by Default: By default the grid contains differences only (with empty folders removed) – if there is only one difference you will see just one item. And the grid always contains all the actions resulting from the comparison – while you can hide an action temporarily within a contracted group it is always present in the grid and will apply to the update or script unless you exclude it by unchecking the action.

Equal Objects filter:
A toolbar button adds equal objects to the grid. Enabling this is useful if you want to review, for example, unchanged columns alongside the changed columns in a table.

Unsupported Actions filter: You can also choose to see unsupported actions – these result from differences for which there is no supported action that can be taken on the target. These typically result from differences in server objects or built-in types between schema versions.

Action Icons: Actions (Add, Change, and Delete) are visualized using icons, making it easier to absorb a set of changes at a glance. The checkbox alongside an icon indicates if the action will be included in the update or generated script. If there is no icon the item will not be included in an update or script.

Grayed Items: Items that do not contribute to the update are grayed – excluded actions, unsupported actions and equal objects are all grayed. Folders are grayed when all their contents are grayed making it easy to see when a group of differences have all been excluded without you needing to drill in.

Grouping: By default, items are grouped by action so you can quickly assess what changes will be made on update. You can also group the results by object type or by schema. You can expand or collapse a group to temporarily hide detail, and you can exclude all or include all objects in a group.

Refactor Highlighting: Schema Compare processes the refactor log if present when targeting a database. Refactoring is indicated in the grid as a change action with the source name bolded to highlight the new schema and/or name. Refactoring will cause objects to be renamed in the database. Refactoring sometimes also shows up as a second order effect on other objects that SQL Server will modify when applying the rename. These will not be marked as actions in the grid as you cannot exclude them, but you will see the changed script if you select the affected object.

Probably the biggest set of changes affects the script difference pane. While the grid provides a great overview, to see all changes to an object in the grid you have to fully expand it, which, can quickly clutter the view if you’re reviewing many objects. To address this we’ve focused more attention on the script differencing experience – after all, you are writing and editing object scripts to begin with. Changes include:

Expanded Object Scripts: The script difference pane now shows the combined scripts for an object and its hierarchical children. This gives a complete picture of all the changes affecting an object in one easy-to-scan place. To complement this, the Next and Previous buttons step between top-level objects only. Together, these two changes can dramatically simplify scanning through the results of a comparison.

Enhanced Script Differencing: The script difference algorithm now treats child objects as discrete entities, more effectively highlighting those that have been added, deleted or changed. The color scheme is now more subtle and better reinforces the direction of changes. And remember that you can expand the script pane or swap it to the top – so you can easily optimize the layout to better focus on reviewing scripts.

The screen shot below highlights many of these improvements.

Reference
http://blogs.msdn.com/b/ssdt/archive/2012/03/23/schema-compare-improvements.aspx

Ken Cenerelli

My life in software development

scomfaq.wordpress.com/

Things about System Center and Cloud...

Build HoloLens

All about HoloLens

DevDays®

For web designers and cloud developers

Build Azure

All about the Microsoft Cloud

vishal patel

Software Developer, Windows 8 and Windows Phone Enthusiast

SQL with Manoj

SQL Server (TSQL) Programming, DB concepts, Tips & Tricks with >400 articles... comments welcome!!!

dragablz.wordpress.com/

Dragable, tearable, dockable WPF TabControl. Open source to boot.

Adrian Hall

Because Developers are Awesome

Ratish Philip's Blog

Another adventure in code...

codematrix

Application Architecture at it's best

One Unicorn

Thoughts from one member of the Entity Framework team...

Rachel Lim's Blog

Simplifying programming into something I can understand

.NET Developer's Blog

Software Development, Flying and Life

The Flying Maverick

Software Development, Flying and Life

Hiking Photography

Beautiful photos of hiking and other outdoor adventures.

paint.net blog

The best free image and photo editor. By Rick Brewster.

Learning by Shipping

products, development, management...

Nassau Boy's Trading Thoughts

Never Mind the Noise in the Market, Just Mind the Price of the Fish

%d bloggers like this: