• If you really want to use DTS, you can set anything you'd like in code. For the SQL, check the SourceSQLStatement of the DataPumpTask object. For the text file name and location, set the datasource property of the connection object. With the exception of file format translations, there is little you can do with DTS that cannot be done with TSQL. If anyone knows how to take an excel file and import it using only TSQL, I'd like to hear about it!

    Now for some stupid questions...

    Why not use bcp and xp_cmdshell?

    If you're going to involve VB, why write all those property let statements instead of passing those values to your procedure? i.e.

    sqltoText(ByVal server as string, ByVal database as string, ByVal sql as string, ByVal filename as string, ByVal ConString as string)

    Finally, why not;

    txt.Write rs.GetString

    Please advise.