Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 output table date to excel sheet using DTS

Author  Topic 

Green
Starting Member

1 Post

Posted - 2002-12-18 : 11:21:08
Hi

I am trying to output data from a SQL server table to an excel sheet using a query and by using DTS. It created the excel sheet without any problem. But when I execute the DTS package again and again, the initial excel sheet gets appended with data rather than creating a new set of data. ie, I need the excel sheet to contain always current data rather than having all data from the previous DTS execution.

Any ideas..

Thanks in Advance

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2002-12-18 : 17:37:35
Option 1.
You can create a linked server for the excel sheet using the oledb driver for excel and then run an execute sql task to delete before you transfer the data

Option 2.
You can use Ole automation extended stored procedures sp_OA* to create an Excel Object and delete the data before you transfer the data.

Option 3.
You can use sp_cmdshell and delete the old excel spreadsheet and create a new one before you transfer the data.

Option 4.
More involved you can write some vb/vbs to create a the whole script for the dts task and pass to this script the name of a new excel spreadsheet.

There's probably more many more ways but I would start with Option 1 and see if that works for you.


Go to Top of Page
   

- Advertisement -