EDIT Jan 24, 2010: Tony Davis blogged about this post in his article Life at the F# end providing a revised solution that is more F#-like as follows:
db.Tables |> Seq.cast |> Seq.collect (fun (t:Table) -> t.Script() |> Seq.cast) |> Seq.iter (fun s -> printfn "%s" s);;
You'll need to read the article for an explanation of the F# code. Tony also suggests F# as a common scripting language for both developers and administrators. My thought on the subject is that Powershell is the common scripting language for administrators, but perhaps F# may have a niche use case for administrators needing better scale--I would love to see more practical examples of F# administration scripts. Be sure to read the comments section in which I respond with my reasons for exploring F# out of a need to achieve some concurrency missing from Powershell. Oh, and I also appologize for making someones' teeth itch with my use of imperative looping in F#
Thanks for sharing - I don't think I've ever even seen an example of F# before.
There's something strangely satisfying about doing a google search for F# SMO and seeing this little blog post hit #1.The free e-book "The F# Survival Guide" is a quick and easy read if you're interested in getting started with F#.
In a fascinating interview in this issue of Simple-Talk, Don Syme discusses his work on the F# programming...
Hi Chad,
I really enjoyed your piece, and I hope my editorial didn't come across as in any way dismissive of your solution. It works fine; I was just intrigued to find out what a more "F#-like" solution would look like and to see how much truth there was in the idea that it was an approach "more intuitive to SQL developers". I think the jury is still out!
Anyway, thank you for inspiring me to take a closer look at F#!
Cheers,
Tony.
Tony,
As you folks say, "No Worries." I didn't take offensive to your post in the least in fact I was pleasantly surprised to see F# code closer to what I wanted to do.
I'm not sure about the intuitive part either.
Thanks for sharing
Pingback from F# February 2010 CTP « Sql From Hell.com