I'm hoping I could do this using the Scripter w/in the SMO Utility Classes. Can anyone help me out?
Thanks in advance!Hi,
use the transfer method of the scripter:
http://blogs.msdn.com/mwories/articles/smosample_transfer.aspx
HTH, Jens K. Suessmeyer.
http://www.sqlserver2005.de|||Thanks Jens. Just what I was looking for. :-)|||Take a look at this free tool -- it scripts out all database objects in a manner which mimics Visual Studio for Database Professionals [the "Data Dude"]. That is, it creates a separate file for each object in the database in an organized file tree.
http://sourceforge.net/projects/script-sql-db
Richard|||Would anyone happen to know how I could get the end of a batch of Transact-SQL statements; i.e "GO" statements to show up in generated script?
Thanks.|||As you get a stringCollection using the
System.Collections.Specialized.StringCollection s = t.ScriptTransfer(); // Or use ScriptTransfer() if you need to capture the script (without data)
You can simply modify the script on your own.
HTH, Jens K. Suessmeyer.
http://www.sqlserver2005.de
|||Well, yes, I see your point, but then wouldn't I have to write a decent amount of conditional code to to determine if I need a "GO" line or not? Assuming I would not want a "GO" statement on each line as I'd like to batch some of the operations.I noticed that the scripter object generates code with the embedded "GO" statements, does the transfer object not provide this capability?
Thanks.|||There is a property in the Transfer object named 'FileName'. When you supply this property with a file path the generated script is output to a text file and the 'GO' statements are in the text file.
No comments:
Post a Comment