Windows Scripting
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsSystem AdministrationWindows Scripting

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 24th, 2008, 01:29 PM
akpaga akpaga is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 135 akpaga User rank is Corporal (100 - 500 Reputation Level)akpaga User rank is Corporal (100 - 500 Reputation Level)akpaga User rank is Corporal (100 - 500 Reputation Level)akpaga User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 2 h 38 m 41 sec
Reputation Power: 4
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

Reply With Quote
  #2  
Old October 24th, 2008, 06:10 PM
garman garman is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2007
Posts: 79 garman User rank is Sergeant Major (2000 - 5000 Reputation Level)garman User rank is Sergeant Major (2000 - 5000 Reputation Level)garman User rank is Sergeant Major (2000 - 5000 Reputation Level)garman User rank is Sergeant Major (2000 - 5000 Reputation Level)garman User rank is Sergeant Major (2000 - 5000 Reputation Level)garman User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Day 1 h 21 m 46 sec
Reputation Power: 42
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).

Reply With Quote
  #3  
Old October 25th, 2008, 09:23 AM
akpaga akpaga is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 135 akpaga User rank is Corporal (100 - 500 Reputation Level)akpaga User rank is Corporal (100 - 500 Reputation Level)akpaga User rank is Corporal (100 - 500 Reputation Level)akpaga User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 2 h 38 m 41 sec
Reputation Power: 4
Quote:
Originally Posted by garman
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).


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.

Reply With Quote
  #4  
Old October 27th, 2008, 05:05 PM
akpaga akpaga is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 135 akpaga User rank is Corporal (100 - 500 Reputation Level)akpaga User rank is Corporal (100 - 500 Reputation Level)akpaga User rank is Corporal (100 - 500 Reputation Level)akpaga User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 2 h 38 m 41 sec
Reputation Power: 4
i got the vb script to work for my application.

Reply With Quote
  #5  
Old October 27th, 2008, 05:27 PM
garman garman is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2007
Posts: 79 garman User rank is Sergeant Major (2000 - 5000 Reputation Level)garman User rank is Sergeant Major (2000 - 5000 Reputation Level)garman User rank is Sergeant Major (2000 - 5000 Reputation Level)garman User rank is Sergeant Major (2000 - 5000 Reputation Level)garman User rank is Sergeant Major (2000 - 5000 Reputation Level)garman User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Day 1 h 21 m 46 sec
Reputation Power: 42
well done

Reply With Quote
  #6  
Old November 12th, 2008, 10:43 AM
akpaga akpaga is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 135 akpaga User rank is Corporal (100 - 500 Reputation Level)akpaga User rank is Corporal (100 - 500 Reputation Level)akpaga User rank is Corporal (100 - 500 Reputation Level)akpaga User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 2 h 38 m 41 sec
Reputation Power: 4
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.

Reply With Quote
  #7  
Old November 17th, 2008, 03:16 AM
Shadow Wizard's Avatar
Shadow Wizard Shadow Wizard is offline
Moderator From Beyond
Click here for more information
 
Join Date: Sep 2004
Location: Israel
Posts: 29,260 Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)Shadow Wizard User rank is General 23rd Grade (Above 100000 Reputation Level)  Folding Points: 587377 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587377 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587377 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587377 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587377 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587377 Folding Title: Super Ultimate Folder - Level 2Folding Points: 587377 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 3 Months 2 Weeks 2 Days 30 m 22 sec
Reputation Power: 2509
--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?

Reply With Quote
Reply

Viewing: ASP Free ForumsSystem AdministrationWindows Scripting > Vb Script to add a missing coloumn to text file


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 10 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek