This is two problems, both widely documented on the web. One is to get the data out of SQL Server. Then next is to iterate over this data and write it to a file. If you haev VB2005, you have the my.filesystem shortcut, which just hooks into the System.IO namespace to create files.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog