What are the challenges you face when working across database platforms? Take the survey
Options

Comparing with Custom Keys

Hi,

Suppose I've got a Table with a GUID (which is the primary key), a Name, a Description and a Datetime stamp. Comparing based on the GUID is not going to work in my case, I need to compare based on the Name. I've choose to compare based on the custom key but the problem now is there are some clashes where the Name between the source and target is different but the GUID is the same. How can I generate a new GUID to allow the insert to work? Also, this means all references to the old GUID in the source also need to be changed to the new GUID, is this possible?

Cheers,

Befuddled Newb.
Tagged:

Answers

  • Options
    Jessica RJessica R Posts: 1,319 Rose Gold 4
    Hi @NelsonG,

    Thanks for your post!

    I'm sorry to say that I'm struggling to think of a way to achieve this with SQL Data Compare.

    Can I just check - is the primary key/ GUID value automatically assigned?

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?


  • Options
    NelsonGNelsonG Posts: 2 New member
    Hi @Jessica R

    Thanks for replying.

    Yes, the primary key/GUID is defaulted to NEWID() for new rows. I've tried unmapping the GUID column hoping it would try to not insert anything for that column which would force it to use the default value instead but from looking at the insert scripts it generates, it's still trying to pass the original GUID from the source table causing the GUID clash.

  • Options
    Jessica RJessica R Posts: 1,319 Rose Gold 4
    Thank you @NelsonG

    I've been thinking about this and consulted with our developers, but I'm again really sorry to say that there isn't a feasible way to do this with SQL Data Compare. :(  GUIDs are not treated differently from any other data type, so SQL Data Compare does not know that it is safe to assign rows with a new GUID.

    (While we don't have any plans for it in the immediate future, I have logged a request with reference SDC-3135 for SQL Data Compare to provide option to assign rows with a new GUID.)

    So sorry that SQL Data Compare can't help in this case!

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?


Sign In or Register to comment.