need help badly.i have this:using System.IO;using Microsoft.SqlServer.Server;public partial class FileSystem{ [SqlFunction(IsDeterministic = true, IsPrecise = true)] public static bool DeleteXmlFile(string xml_file) { System.IO.FileInfo obj_fso; bool is_successfully_deleted = false; obj_fso = new System.IO.FileInfo(xml_file); if (obj_fso.Exists == true) { obj_fso.Delete(); is_successfully_deleted = true; } return is_successfully_deleted; }}
and compile it:csc /target:library /out:"C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\StradSqlClrFileSystemDeleteXmlFile.dll" "c:\cs\FileSystemDeleteXmlFile.cs""
then execute this:IF NOT EXISTS (SELECT * FROM sys.assemblies asms WHERE asms.name = N'StradSqlClrFileSystemDeleteXmlFile')CREATE ASSEMBLY [StradSqlClrFileSystemDeleteXmlFile]FROM 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\StradSqlClrFileSystemDeleteXmlFile.dll'WITH PERMISSION_SET = UNSAFEGO
and this:SELECT dbo.udf_delete_xml_file ("directory:\some_files")
and got this problem:A .NET Framework error occurred during execution of user defined routine or aggregate 'udf_delete_xml_file': System.UnauthorizedAccessException: Access to the path 'c:\myxmlfile.xml' is denied.System.UnauthorizedAccessException: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileInfo.Delete() at FileSystem.DeleteXmlFile(String xml_file)
please.. please help...