Totally untested, I'm not at my desk any more.
using Microsoft.SqlServer.Server;
using System.Data.SqlTypes;
using System;
using System.IO;
namespace XMLWriter
{
public class XMLWriter
{
[SqlFunction]
public static SqlString ReplaceMatch(
SqlString inputXMLString,
SqlString outputFileDIR)
{
try
{
// input parameters must not be NULL
if (!inputXMLString.IsNull &&
!outputFileDIR.IsNull)
{
System.IO.StreamWriter file = new System.IO.StreamWriter(outputFileDIR);
file.WriteLine(inputXMLString);
file.Close();
}
else
// if any input paramater is NULL, return NULL
return SqlString.Null;
}
catch
{
// on any error, return NULL
return SqlString.Null;
}
return new SqlString();
}
};
}