File Functions for SQL. Implemented as a SQLCLR assembly. Compatible with SQL 2008 and SQL 2008R2. May be compatible with SQL 2005, but untested.
Copy File, Delete File, Delete Files, Get File Specs, Make Directory, Move File, Save File Image, Get File Image, and more!
This SQLCLR library uses the EXTERNAL ACCESS permission set, because it access the file system.
This library implements these features as Stored Procedures:
Get File Specs
Save File Image - Take binary data and write it to the file system.
This library implements these features as Scalar UDFs:
Break File Name With Path For File Name - Take a file name with path and return just the file name portion.
Break File Name With Path For File Path - Take a file name with path and return just the path portion.
File Exists Check - Returns whether a specified file exists.
Folder Exists Check - Returns whether a specified folder exists.
Get File Image - Returns the binary data for a file.
This library implements these features as Table Value UDFs:
Break File Name With Path - Take a file name with path and return it as a table broken out as path and file name.
Get Directory List - Returns the director items for a specified path as a table.
Get File Specs - Similar to the stored procedure but returns as a table.
Please see the notes.txt file in the source code. It contains instructions on how to setup the system to accomodate an external access SQLCLR library. There are also scripts included to apply the sproc and function definitions.