Script vs. DB comparison not ignoring formatting

ArnaudArnaud Posts: 3 New member
edited August 23, 2019 10:51AM in SQL Compare
Hi,

I'm using SQL Compare 13.7.16.11325 Professional.
I'm comparing a script folder (coming from an unpack of a DacPac) to a DB.

Even though I checked the "ignore comments" and "ignore whitespace" options, the result flags SP changes because of formatting and comments.

For example:

SELECT foo, bar

will be shown as different from

SELECT    foo,
                  bar

I'm expecting the "ignore whitespace" option to treat these 2 sections as the same.

Cheers.
Tagged:

Answers

  • Alex BAlex B Posts: 1,151 Diamond 4
    Hi @Arnaud,

    Is it actually showing them as different or just highlighting the textual differences when you select them?

    I've just tried this and I have the two stored procedures shown as identical in the top results pane when it's only whitespace as you've shown that is different, but you can see it still highlights the textual differences in the bottom pane when you select the object:


    The above is on SQL Server 2017 with SQL Compare 13.7.16 (I also tried on 13.7.21 that I had installed at the time with the same result).

    Are there any other differences you can see like style of line ending used (CR/LF vs LF)?  Do they show up as the same but different, or only in one or the other target/source?

    Kind regards,
    Alex
    Product Support Engineer | Redgate Software

    Have you visited our Help Center?
  • ArnaudArnaud Posts: 3 New member
    Thanks for the reply.

    The code shows up in the "in both, but different" section.
    That happens even though the code differs only only formatting (newlines mismatch and spaces).

    PS: the company I work for doesn't allow file upload so I can't share my output.

    Cheers.

  • Alex BAlex B Posts: 1,151 Diamond 4
    Hi @Arnaud,

    Are the line ending styles different between the script file and what's in SQL Server (i.e. if you edit the stored procedure in SSMS then copy that to a new text editor where you can see the line endings is one LF and the other CRLF)?  And what collation is the database?

    I'm not sure what else might impact this - it must not be the whitespace itself and new lines because it's working in my case.

    Kind regards,
    Alex
    Product Support Engineer | Redgate Software

    Have you visited our Help Center?
Sign In or Register to comment.