Fervent Coder

Coding Towards Utopia...by Rob Reynolds
posts - 278 , comments - 431 , trackbacks - 0

My Links

News


Rob Reynolds

Subscribe to Fervent Coder RSS
Subscribe to Fervent Coder by Email

About Me

I manage several open source projects. Need...
   ...package management for Windows?
   ...automated builds?
   ...database change management (migrations)?
   ...your application to check email?
   ...a monitoring utility?

I also write for



Like what you are reading? Want to buy me a cup of coffee?
PayPal - The safer, easier way to pay online!

Archives

Sites

RoundhousE – ADO.NET over SMO

One thing most database change management tools use is SQL Server Managment Objects (SMO).  Most do that because ADO.NET doesn’t allow the batch statement separator keyword GO in sql statements.  So most people write off the ability to use a database change tool for sql server without actually having the sql server installed on the machine that is running the tool. This is not a reality in some organizations, especially when licenses for SQL server are limited. 

RoundhousE_Logo Split the GO

Recently, a few guys have really been helping me get RoundhousE (RH) to the point of not using SMO anymore.I’d like to thank Jochen and Pascal for all of your hard work recently on this and bearing with me while we worked out getting the regex ironed out for splitting sql statements on GO when it isn’t in a comment section.

There only two requirements with GO statements when using RH. The first one (a good practice IMHO) is that GO has to be the last statement on a line. The second is that using GO in between tick marks (‘), like for inserting it into a table, be sure it isn’t the last statement on a given line. This second one is a low possibility, but worth mentioning for those that might structure string insert/updates with GO in them in such a format.

So to recap:

Good Stuff

sql statements GO

something something
GO

some more statement action go

/*
Use some database
GO
*/
--GO
--something something GO

Not Gonna Work

do something GO do something else

insert into sometable (id, description)
VALUES
(1, 
' yep yep. uh huh...ya ya ya ya ya. GO
')

Favor ADO.NET over SMO

Those that have been using RH know that they can use it with SMO for 2005 and 2008. Being able to switch out either one of these has been a lifesaver for some organizations that have not yet upgraded to sql server 2008. Right now RH is in a transition state where SMO is still accessible while ADO.NET is really feeling it’s way out. So if you are using sql2005 or sql2008 now, you can continue doing so. Keep in mind that those will be deprecated in favor of ado.net at some point.

Go check it out! To use the new ado.net version, just change the databaseType (/dt in console) to “sqlserver”.  Please let me know if you find any problems with it.

databaseType="sqlserver"

For those that use Oracle, be on the lookout for coming support. Also, Fluent NHibernate lovers, be ready for some schema script generation!

Print | posted on Tuesday, February 23, 2010 9:49 PM | Filed Under [ Code RoundhousE chucknorris ]

Feedback

Gravatar

# re: RoundhousE – ADO.NET over SMO

Actually I lied. Now that I have it all working, the above will work just fine. At least revision 150 on.
3/8/2010 9:11 PM | Robz
Comments have been closed on this topic.

Powered by: