Forum for users of SQL Toolkit 3,4,and 5
Our SQL scripts are initially generated from SQL compare and checked into version control. There is also a need to quickly generate a new script for a single object. For that we are currently using SMO. This of course can result in inconsistent formatting in the scripts producing source control differences when none were intended.
We would like to use the RedGate engine to do all of the formatting. There are 2 ways that we can think of to accomplish this.
1. Is there a way to call a RedGate API that will quickly script out a single object, without having to register and compare the entire database? If so, we would use this instead of SMO.
2. Or, is there a RedGate API that will take an input script and generate a formatted output script, similar to the Layout function of SQL Refactor?
- Posts: 1
- Joined: Tue Mar 04, 2008 1:26 am
You have to register the entire database in order to script out an object, but you don't have to compare it to anything.
Once you have registered the database, create a new Work object (constructor has no parameters) and call Work.ScriptObject on the single object you want to script out (you can find the relevant IDatabaseObject by navigating through the Database object you get from registering the database).
Partial database registration is on our list of things to do but realistically we're not going to get around to it for some time because normally just registering the entire database is fast enough.
- Posts: 529
- Joined: Mon Oct 30, 2006 12:45 pm
- Location: Red Gate Software
Return to SQL Toolkit Previous Versions
Who is online
Users browsing this forum: No registered users and 0 guests