Friday, March 23, 2012

Reset Excel Destination for Error Logging

I am using sheets in an Excel spreadsheet to receive redirected error rows. The trouble is that it keeps appending the rows to the bottom of the sheet - even if I delete the rows in the spreadsheet. If I remove the spreadsheet all together then I need to set-up the Excel Desitnation Sheets again.

Each time I run the Control Flow I would like it to be removing old log entries and writing in the new ones.

There must be an easy way?

Unfortunately the Excel driver does not support anything like TRUNCATE TABLE. Even if you opened Excel and cleared the contents of those rows, the driver would still see them as "used" ... the only solution is to delete the rows themselves from within Excel. And you would want to check the range definition to make sure that you were in fact deleting all the rows in the range.

Of course the cleaner solution would be to drop and recreate the table. You could use an Execute SQL task for this purpose, and probably get one of the SSIS components to write the SQL for you to copy and paste in.

-Doug

No comments:

Post a Comment