In article <057001c37e2f$ec0c5620$a401280a (AT) phx (DOT) gbl>, Denise Watson
<dwatson (AT) ksfcu (DOT) org> writes
Quote:
I have 2 different DTS packages that create files weekly.
The one that creates the .csv file overwrites itself each
week with the updated information. The one that creates
the .xls file won't overwrite it. I tried deleting the
file each time, but if the file isn't there the DTS
package errors out. It seems the only way it will put in
fresh data is if the excel file already exists and is
empty.
Any ideas? |
You can check if the file exists before deleting it to prevent the
package failure.
If using ActiveX Script -
Working with files and the FileSystemObject
(http://www.sqldts.com/default.aspx?292)
If using DOS then you can use "if exists" but you will probably have to
wrap this in a batch file.
When working with Excel files (not CSV though) I have found it easiest
to create a template file which is basically a blank file with
formatting that I want and copy that to the destination file location
immediately prior to export. With CSV you can just delete any existing
files and re-create it from DTS.
--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com
PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org