• OTF (9/13/2012)


    To by pass OLE Automation which you would typically want to do anyway you can put code along these

    lines in a SQL CLR Function to test for the readiness of a file to be read:

    try

    {

    using (File.Open(filepath, FileMode.Open, FileAccess.Read, FileShare.None)) { }

    }

    catch (Exception)

    {

    return false;

    }

    return true;

    Thanks for this approach, I tought about using a CLR function but in that case I would have to deal with CLR authorizations and enabling (pretty much the same to enablig OLE automation) and maintaining an external piece of code.

    Nonetheless it's a valid solution.