This article, along with other great articles, can be found on our SSRS General Index Menu.
There are many tasks that call for writing to a text file. In order to get that done, we usually have to go into the .NET environment to get it done.
Here is a seriously nice piece of code that will allow you to write to a text file using SQL Server 2000. It makes use of the sp_OACreate and sp_OAMethod internal stored procedures to get the job done.
I use this method to write .vb classes, believe it or not. I have the code scan my database and write the data access code for my project. It's a huge time saver. If I write a new stored procedure, I rescan the database and all my data access code is updated, just that easy.