|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Vb Script to add a missing coloumn to text file
I Have a text file that i bulk copy to a sql server table.
But the problem is that the textfile has its last couloumn of its last row in the text field missing.So I manually add some garbage value and then it works properly. The fields are pipe delimited in the textfile. so i need a vbscript that can add a value to the textfile when i run it instead of me manually entering the value. thanks in advance |
|
#2
|
|||
|
|||
|
so you want to take a text file, open it, go down every line entry and add somthing like |N/A on the end?
(it wqould be best to process and add to the DB all at the same time) and what do you want to do this in? Visual Basic as a compiled stand alone exe? VBA in access using Access link to the the sql server to add the data in? In Excel to do the same using ODBC and ADO? Or do you have a IIS web server where you could post the data to a url and have ASP process the data (and add to db if you wish). |
|
#3
|
|||
|
|||
|
Quote:
thanks for your response. Ya ,you got me right i want to add |n/A as the last coloumn in the last row because all the files have only the last coloumn of last row missing. i will add the vb script in SQL server job as DTS package. |
|
#4
|
|||
|
|||
|
i got the vb script to work for my application.
|
|
#5
|
|||
|
|||
|
well done
![]() |
|
#6
|
|||
|
|||
|
i have a slight problem now..
i want to add the field !xxx only when the last data field is missing.. but how can i check that condition in the vb script i have below thanks in advance... Code:
Dim Stuff, myFSO, WriteStuff
Stuff = "|xxxx"
Set myFSO = CreateObject("Scripting.FileSystemObject")
Set WriteStuff = myFSO.OpenTextFile("C:\test.txt", 8, True)
WriteStuff.WriteLine(Stuff)
WriteStuff.Close
SET WriteStuff = NOTHING
SET myFSO = NOTHING
Last edited by Shadow Wizard : November 17th, 2008 at 03:15 AM. Reason: added [Code] and [/Code] tags around code please do that yourself next. |
|
#7
|
||||
|
||||
|
--moved to the Windows Scripting forum.
not sure what you ask.. do you mean you need to check if the last line is equal to something? if so, to what exactly? |
![]() |
| Viewing: ASP Free Forums > System Administration > Windows Scripting > Vb Script to add a missing coloumn to text file |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|