Why do inserted/updated records get moved to the top?

JackAceJackAce Posts: 75 New member
I'm sure this has been asked before, but the search function on phpBB is quite horrible.

When you add or update records, the underlying script puts those records at the top of the generated file in their own SET IDENTITY_INSERT section.

My issue with this is that it makes diffing the file difficult and it makes the svn/git blame history inaccurate when used in conjunction with SQL Source Control.

Is there a reason for this that I am not understanding?


  • Options
    Hi JackAce,

    The order of the data script is pretty much random. The tool was not designed to create scripts that could be read by a diff tool.

    There is an existing feature request under the internal reference number of SDC-1134 to make the scripts order more consistent so they can be handled better by diff tools.

    I will add your details to the existing request.

    Manfred Castro
    Product Support
    Red Gate Software
  • Options
    Can you share the link to this feature request, I’d also like to track it - the static data script files generated are often out of order, with newer rows in their own identity_insert on then off sections, with older data in its own section below it (also wrapped in another identity_insert on/off section).  I do think we have some table or index maintenance scripts they run over the weekend on our servers, bc the incorrect order is often temporary, and seems to resolve itself after a week or so - the data is then in identity order (and SDC considers it a change to the file which means another checkin where there hasn’t actually been any changes, just the ordering in the file has changed).  Any guidance would be appreciated. Thanks. 
Sign In or Register to comment.