Hi,
I have a DTS package that imports a file with data,
performs several checks,
puts all invalid rows in a table,
exports the table to a excel spreadsheet.
My problem is that it appends the data every time. I want it to overwrite the existing spreadsheet. I can't find any option for that.
I use the "Transform Data Task" to do this.
Any suggestions?Do an EXECUTE PROCESS Task and supply a DELETE Command...
But I didn't think it did an append...|||I had the same problem this week. I made a template of the excel sheet, selected the columns needed and created a named range on the excel sheet, and added it as a linked server. Once it's linked like this you can treat the named range like a table and use a delete from statement to clear the sheet.
Run this command from QA to make the excel sheet a linked server, 'excelsource' can be any name you want to give the connection.
sp_addlinkedserver 'excelsource', 'jet 4.0', 'Microsoft.Jet.OLEDB.4.0',
'c:\temp\filename.xls', null, 'excel 5.0'
If the named range on the excel sheet is also named excelsource use
delete from excelsource...excelsource
Saturday, February 25, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment