• I thought the install script for this CLR routine was nicely done, and very useful. The Asymmetric Key side is so often left out.

    I can see why a CLR routine is better than your xp_cmdshell routine. As I see it, it will only work on specific version of the operating system, with a specific date format. Surely, anyone actually trying to use this code will get in a pickle. Another problem you'll come across is the nesting of the INSERT INTO ... EXEC. It seems unfair to use it as a comparison to the CLR routine, since there are ways around the specificity of the code.

    I'm puzzling over the CLR routine. I can't see how you handle the exception that happens when an invalid path is passed to DirectoryInfo. As far as I can see, a NET exception is thrown and just falls back into SQL Server. How does the calling code handle this? The DOS version will politely send back a 'file not found' (depending on language setting etc.) but your CLR routine would surely just barf. Am I missing something?

    Best wishes,
    Phil Factor