How to include 'IF EXISTS' in Script Folder Generation?

yshteymanyshteyman Posts: 4 Bronze 1
edited May 29, 2012 10:46AM in SQL Compare Previous Versions
I am trying to generate DDL using 'Create Scripts Folder' menu in Compare 10.2. My defaults shows checks for this option, but when I open separate script for each table in their folders it doesn't have this clause. My question is how to include it not only in deployment script but when I also generate table folder. If this is not possible how then I can create separate file for each table using synch wizard.

Thank you for your help.
Yulia
Yulia

Comments

  • Thanks for your post.

    I'm afraid neither are possible with the current version.

    The option to create a scripts folder is designed to be used to represent the complete schema of the database so it can be used as a data source. The scripts themselves aren't really designed to be deployed to other environments.

    Likewise, the deployments scripts that can include 'IF EXISTS' are designed to be a single script and can't be broken down per object, unless you go through and create a project for each object. If you right-click on an object in the results grid, you can create a single deployment script for that object, but you can't get it do that for all objects in one go.

    If you don't mind me asking, why do you need the existence checks for each script?

    Feel free to log the suggestion on our uservoice site if you need it added to the tool.
    Chris
  • Yulia,

    Can I ask why you want separate scripts for each object. How do you plan to use them?

    David Atkinson
    Product Manager
    Red Gate
    David Atkinson
    Product Manager
    Redgate Software
  • yshteymanyshteyman Posts: 4 Bronze 1
    David,

    We have install script shipped with our product. The install folder has script for each table and executed by controlled file listing all objects to install. In case an installation failed i want this to be re-runnable picking up from the objects it stopped. Let's say it installed all tables from A-C and failed on FK creation and exited. Next time I run install I want to skip all tables A-C and continue creating objects. I understand that i use script folder as not as intended.
    Yulia
  • Why not just package up the single deployment script in your install without the transaction wrapper option? This way if you run it and it fails half way, it will have progressed.

    David
    David Atkinson
    Product Manager
    Redgate Software
  • yshteymanyshteyman Posts: 4 Bronze 1
    This is how we implemented now. But it is now easy to maintain large single script. For instance, if one table structure change I need to search one large script and it need to be very neatly modify versus re-creating automatically using a tool one file containing ONLy one table that was changed. This change proposed for improving maintenance and avoid possible edit errors. I don't think it hurts adding 'IF EXISTS'...Thanks.
    Yulia
Sign In or Register to comment.