views:

494

answers:

6

I frequently need to compare SQL procedures to determine what has changed in the newest version. The problem is, everyone has their own style of formatting, and SQL doesn't (usually) care about where one puts their newlines (e.g. where clauses all on one line vs. newline before each AND).

This makes it very difficult (especially for long procedures) to see the actual differences. I cannot seem to find a free diff/merge utility that will allow me to ignore newlines (i.e. treat as whitespace). So far I've tried WinMerge and Beyond Compare without any luck. Does anyone know of a diff tool (ideally free) that would see these two examples as identical?

Ex. 1:

the quick
brown

Ex. 2:

the
quick
brown

Thanks in advance.

+1  A: 

I love Araxis merge. Not free but well worth it. it can, among other things, ignore any kind of whitespace if you want.

Byron Whitlock
I'm trying it out (free 30 day trial). I've heard it allows for ignoring newlines, so it may be worth the price.
Prometheus
+1  A: 

What i've done in my own similar case is to use a sql prettifier which will organize two sets of semi-disparate SQL in very similar fashion automatically. i then paste and compare the results with WinMerge.

It's a two-step process but it's much more palatable than many other options, especially when many lines of code are involved.

Link to web-based Sql Pretty printer that's decent.

Paul Sasik
The tool in your first link was perfect for the job. It took a bit of doing to sift through all the trial software and just install the free SQL Server management Studio plugin, but this plugin allows me to reformat the procedures to have the same line breaks. Great Answer! Running the results through WinMerge now supplies usable results.
Prometheus
A: 

If you're on Windows, WinMerge is pretty slick. Under Linux (and maybe OS X), there's Meld.

Both are free as in beer and work pretty well. Not quite as cool as Araxis, but then we don't want you drooling on your desk.

Both are all-purpose diff tools with such features as white space ignoring. I'm not absolutely certain they ignore blank lines, but chances are good they can.

Carl Smotricz
WinMerge can ignore blank lines, but WinMerge will not treat newlines (i.e. in different places) as whitespace.
Prometheus