Introducing MergeUI

What is it?

MergeUi is a addin (VSPackage) for Visual Studio / Sql Server Data Tools projects. It is a ui to create and edit T-Sql merge statements in pre and post deployment scripts.

In this screen shot you can see the merg statement that is generated using the data in the grid which is based on a table created using the metadata in the dacpac about the table:

Screen shot of MergeUi

Where do I get it?

Download it here

How do I use it?

In Visual Studio, open your database project and ensure it has been built to receive the latest changes (it has to have at least been built once as it uses the dacpac as the data source). Then go to the View–>Other Windows–>MergeUI menu command, it is the one with the rather dashing looking “M” icon.

You then choose your project, schema and table to create a merge from - you are then presented with a data grid - put whatever you like in there and then click save.

The merge statement will be saved to the post-deployment script in the project.

What happens if I have no post-deploy script?

It won’t save.

What else?

If you have a merge statement currently defined in a pre or post-deployment script it will read those statements and put the values in the data grid which lets you edit and then save them back out.

If you have the data you want for a table in a database, after you have chosen your table, you can click import, then enter the server name and login credentials, click connect and then choose your database, you will then be presented with another DataGrid with that data in, you can either edit it or just go ahead and click import.

You then have the data in your main datagrid, can edit it or just save it to update the post-deploy script.

Where is the source?

I haven’t published it yet, I am undecided about whether to put it on codeplex or github and am dithering slightly but if anyone wants the source, email me and you can have it.

What are the limitations?

This tool is for managing merge statements to deploy reference data to databases using sqlpackage.exe, it isn’t a general tool to manage your data or anything fancy in any way.

“reference data” tables should be fairly small and should be fairly simple, lookup tables. One potential issue is that the tool doesn’t check for identity columns and add an identity insert, if you need this add it manually - it is possible to add it to MergeUI but I am trying to keep it simple.

Another issue is the order of the scripts, I don’t currently check for foreign keys and order the tables correctly so you might have to do that manually if you have inter-dependencies.

Where are the bells and whistles

I have deliberately left them off, for example if you change the scripts manually or update a table definition then you will need to click the refresh button. It would be possible to setup file watchers and hook into the VS event system but I see this as a tool that is used a few times during a project and not constantly so having a minimal running footprint is important. I am a strong believer in that tools you install should only be using cpu if they are doing something useful - resharper is one tool that is always doing something useful so can be constantly working, this package? No.

It kind of erm, looks a bit, erm not very pretty

That really is rude. Firstly I am a really really bad designer and secondly it doesn’t look that bad and should save you time so please stop crying, your certainly not running it in OSX!


Comments:

Luca Zavarella

March 4, 2015 - 17:01

Version for VS2012

Hi Ed,

could you compile a version of this addon for VS2012?

Thank you.

Ed Elliott

March 6, 2015 - 06:52

Hi Luca - I will take a look

Hi Luca - I will take a look for you!

Anonymous

May 17, 2015 - 13:48

Thank you

Thank you, Ed!

Anonymous

July 13, 2015 - 09:48

Codeplex or github

Hello Ed,
Is it published on codeplex or github? I’d be pleased to help on a few imrpovements (identity, separate files for each table, …)

Ed Elliott

July 13, 2015 - 09:57

Great! https://github.com

Great! https://github.com/goeddie/mergeui any questions shout!