• There are many better ways (IMHO) to get XML from a database to disk than from within a T-SQL context. Have you exhausted all other options? What is your client language? Writing to the file system from a T-SQL context (xp_cmdshell and SQLCLR originate from a T-SQL context) is ill-advised for too many reasons to list here. Using SQLCLR will not allow you mark the assembly as SAFE, a red flag that you should look for alternatives.

    What will be invoking the process that exports XML? A user pushing a button on a front-end somewhere? A batch process?

    bcp.exe can extract xml columns to disk.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato