Red Gate forums :: View topic - How to include 'IF EXISTS' in Script Folder Generation?
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Compare 10
SQL Compare 10 forum

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

Search in SQL Compare 10 forum
Post new topic   Reply to topic
Jump to:  
Author Message
yshteyman



Joined: 25 May 2012
Posts: 3

PostPosted: Fri May 25, 2012 6:28 pm    Post subject: How to include 'IF EXISTS' in Script Folder Generation? Reply with quote

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
Back to top
View user's profile Send private message
Chris Auckland



Joined: 24 Oct 2006
Posts: 757
Location: Red Gate Software Ltd.

PostPosted: Mon May 28, 2012 3:28 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail
David Atkinson



Joined: 05 Dec 2005
Posts: 1123
Location: Twitter: @dtabase

PostPosted: Mon May 28, 2012 10:26 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail
yshteyman



Joined: 25 May 2012
Posts: 3

PostPosted: Tue May 29, 2012 2:54 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
David Atkinson



Joined: 05 Dec 2005
Posts: 1123
Location: Twitter: @dtabase

PostPosted: Tue May 29, 2012 3:18 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail
yshteyman



Joined: 25 May 2012
Posts: 3

PostPosted: Tue May 29, 2012 3:46 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group