>What are your "raw materials" -- will you have one file with a bunch
>of T-SQL for MSSQL, and a separate file with a bunch of PL/SQL for
>Oracle?  Or are you trying to implement some logic in the code itself,
>that will "just work" on various database platforms?

I'll know by means of some reg lookups I am doing up front. The sql
script will be handed down from the devel guys expecting the right db
so this part is trivial.

>If the latter, this is a rather difficult problem.  Project like
>NHibernate and FluentMigrations exist in this space... it is some
>effort to learn how to use them, and they don't do everything anyway
>(*especially* in the area of DDL / sprocs / etc.).
>
>If the former, there are plenty of C# and VB.NET examples out there;
>the general pattern is below... You should be able to adapt this to
>Powershell with the [new-object] mumbo jumbo... this stuff is in the
>System.Data.Common namespace:

Yup, after finding Michaels blog post almost immediately, I got that far.

>/* 'factory' is the invariant name of a DbProviderFactory known to the
>.NET runtime, registered either in app.config or machine.config */
>var factory = DbProviderFactories.GetFactory(factory);
>var conn = factory.CreateConnection();
>
>/* 'cstr' is a database-specific connection string; something like
>'Data Source=.;Initial Catalog=foo' for MSSQL */
>conn.ConnectionString = cstr;
>conn.Open();
>
>/* now do stuff */
>var cmd = conn.CreateCommand();
>cmd.CommandText = "select * from blar"; // or pull commands from a file

And thats the part that I am still working on, I was hoping not to iterate 
through
the cmds in a file as there is a bunch of GO statements etc. I am hoping to
execute the file as a whole script.

Thanks guys!
jlc
~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to [email protected]
with the body: unsubscribe ntsysadmin

Reply via email to