|
-
Jul 19th, 2006, 02:20 AM
#1
Thread Starter
Hyperactive Member
Insert Text at beginning of file with vbscript
Hi Team
I need to insert a line of test at the beginning of a csv file using an ActiveX Script Task in SQL 2000. Does anyone know of an elegant way to do this?
Thanks FW
-
Jul 19th, 2006, 09:19 AM
#2
Re: Insert Text at beginning of file with vbscript
Open an output file. Write the line to be inserted. Open the existing file. Read it and write it to the output file. Close both files. Kill the input file. Rename the output file to the original name.
You can't insert into an existing file.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Jul 19th, 2006, 06:44 PM
#3
Thread Starter
Hyperactive Member
Re: Insert Text at beginning of file with vbscript
Thanks AL, I was hoping there was a way without copying the whole contents. But never mind, looks like this is the way.
RW
-
Jul 20th, 2006, 04:27 AM
#4
Re: Insert Text at beginning of file with vbscript
another way you can do it, though it may not be popular here, is to write the additional information to a new file then shell to dos and use copy to combine the 2 files
To append files, specify a single file for destination, but multiple files
for source (using wildcards or file1+file2+file3 format).
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|