• Thanks for the comments guys, useful feedback like this is always much appreciated.

    Unfortunately, yes, scripting of the table & stored proc security permissions does seem to be a limitation of this method, and was something I spotted only after submitting this article. It did make me wonder why it had not been included by MS - I'd have expected to see them applied after each object definition, or perhaps in a separate file.

    Other than manually scripting them I'm afraid I can't offer a reasonable way around this at present.

    With regard to the object order, probably the best way to deal with that is to do it with a number of passes, and not drop the objects which have already been created between each run of the script.

    It's messy as you'll get lots of 'object already exists' errors, but at least it does eventually solve the creation order dependency problem.

    How MS get around this in the upgrade scripts is something of a mystery, but it might explain why they take so long to run.


    Jon