Hi everybody,
I have a fairly complex query which I wish to export to a CSV file on a daily basis and then e-mail a recipient.
The Problem
First of all I have tried to write the results of the query to a .CSV file using a BCP command but SQL complains that the query is too long to be used as a BCP argument
Secondly I have tried to use DTS using the data pump task using a text file as a destination. However...
The text file task forces you to select a file that is already created. This would be fine except that each time I run the task I want the results in the CSV file to overwrite the old results from the previous run. How do I do this? DTS doesn't give you the option of overwriting text file results in the data pump task.
I have had similar problems before with DTS - DTS is one of the parts of SQL Server I find fairly awkward and don't feel I have mastered. I would happy to do this some other way too if that is best. Any help on this would be hugely appreciated.
Nassy
I have a fairly complex query which I wish to export to a CSV file on a daily basis and then e-mail a recipient.
The Problem
First of all I have tried to write the results of the query to a .CSV file using a BCP command but SQL complains that the query is too long to be used as a BCP argument
Secondly I have tried to use DTS using the data pump task using a text file as a destination. However...
The text file task forces you to select a file that is already created. This would be fine except that each time I run the task I want the results in the CSV file to overwrite the old results from the previous run. How do I do this? DTS doesn't give you the option of overwriting text file results in the data pump task.
I have had similar problems before with DTS - DTS is one of the parts of SQL Server I find fairly awkward and don't feel I have mastered. I would happy to do this some other way too if that is best. Any help on this would be hugely appreciated.
Nassy