August 30, 2005 at 2:28 pm
Hi,
I am writing a report to an xls file from a sql server table. I want to delete the existing xls file that I am going to write to or to "drop" it would be best.
I was able to do this when doing a transformation between txt to excel, but am not having luck droping the xls file now.
Anybody know the way to do this?
Very appreciated,
Mike
August 30, 2005 at 2:39 pm
are you using vb ?! does kill fileName not work ?!
**ASCII stupid question, get a stupid ANSI !!!**
August 30, 2005 at 2:44 pm
Actually, it is a pretty simple confection at this point, just a copy column report from my dynamicly built table.
I had success though, using the table name of the connection to the xls file, and dropping it with that.
thanks for input.
-Mike
August 31, 2005 at 7:52 am
The drop table name method that I was using only seemed to work for a couple of times. then the dts didn't like it and totally refused to work well at all.
How might I employee this kill file method through an exclusive procedure. that is, I would like to kill a specific file, then run my dts functions which create a table, copy info from a sql table and post that data into a xls file.
I just need to kill the xls file before the copy or else I am appending records where I need an exclusive data set.
August 31, 2005 at 8:00 am
what syntax were you using for "drop table..." and why do you say that the dts didn't like it...did you get any error messages ?!?!
If you post your code, someone may be able to help you out!
**ASCII stupid question, get a stupid ANSI !!!**
August 31, 2005 at 8:54 am
You might try adding an ActiveX Script object to the DTS and using FSO (FileSystemObject) like below...
Set fso = CreateObject("Scripting.FileSystemObject")
Set fileObject = fso.GetFile("yourfile.xls")
fileObject.Delete
Set fileObject = Nothing
Set fso = Nothing
September 1, 2005 at 10:04 am
See this article I posted a while back:
http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=19&messageid=187740#bm187760
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply