Error while Generating Scripts folder-item key already added

austin183austin183 Posts: 2
I have tried to Generate a Scripts folder from a database directly, and I get the error "An item with the same key has already been added".

So I tried to create a snapshot from the database instead, and that worked. Then I tried to generate a Scripts folder from the snapshot, and I received the same error.

Then I tried creating a Snapshot using the "Treat items as case sensitive" option. That worked, so I tried to generate the scripts from that snapshot. Same Error.

Then I tried to compare my snapshot to the database. It returned 145 identical objects, and it showed me the Creation scripts in comparison format. However, I would have to manually copy all the creation scripts by hand into my folder at this point.

So two things:

1. Why would I receive the error when generating scripts but not when doing a comparison?

2. Why can I not mass export scripts from the Comparison screen to a folder?

Aside from this issue, I really like this tool. Thank you for writing awesome software products like SQL Compare!

PS: I am on version 9.0.0.79, and my database resides on a SQL Server 2008 v 10.0.1600 instance.

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 New member
    I couldn't say why the comparison to scripts folders would throw an error without having a copy of the scripts folder. But in general, if the scripts were not written by SQL Compare or had been modified by hand, it's not guaranteed to work and any errors you get will be totally random.

    It is also possible to synchronize to an empty scripts folder but if you just want to script only the differences between databases you can do the comparison, and open the synchronization in SQL Server Management Studio, or use the option to save a copy of the script.
  • I was also caught in similar situations...I think this error occurs when if there are two scripts exists with different name to create same object..

    e.g Ix_index.SQL and Ix_Index_1.sql both creates same index IX_Index
  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Definitely. You cannot try to create the same object twice.
Sign In or Register to comment.