• 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();

    }

    };

    }


    Forever trying to learn
    My blog - http://www.cadavre.co.uk/
    For better, quicker answers on T-SQL questions, click on the following...http://www.sqlservercentral.com/articles/Best+Practices/61537/
    For better, quicker answers on SQL Server performance related questions, click on the following...http://www.sqlservercentral.com/articles/SQLServerCentral/66909/