| Author |
Message |
kevinu
Joined: 04 Mar 2008 Posts: 1
|
Posted: Tue Mar 04, 2008 1:43 am Post subject: API to layout SQL scripts? |
|
|
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?
Thanks!
Kevin
Sage Software |
|
| Back to top |
|
 |
Michelle Taylor
Joined: 30 Oct 2006 Posts: 519 Location: Red Gate Software
|
Posted: Tue Mar 04, 2008 12:19 pm Post subject: |
|
|
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. |
|
| Back to top |
|
 |
|
|
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