Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help

Status
Not open for further replies.

SQLBaby

IS-IT--Management
Jan 3, 2003
158
US
I never use VB, but may be any body help me.
Well, i need to get data from text file and want to save it in SQL table. I can get it through SQL directly but the problem is data is not in sequence in .txt file. for example the text file is look like

Company name, date, time, address..... 9Some other information) then

Acct:00100,EXP,114
REG: $44000.00 OVERTIME: $16500.00
ACCT:00100,EXP,131
REG: $81000.00 PERSONAL: $15000.00 HOLIDAY: 5424.00

ACCT:00100,EXP,080
SALREG: $45678.00 VAATION: 25000.00 ....etc etc

i need to get information and save in the the specific column. like..
00100 will save in Dep. number
EXP will save in Department name
080 will save in code
all different valuse will be saved in their related columns like

Reg: $81,000.00 will save as 81000.00 in Salary columns.

Can any body help me for that.

Thanks in Advance




Knowledge is a key of success.



 
Build your SELECT INTO statement with the fields list in the order you want the fields to be inserted, using an alias field name for the fields names that are actually in the table.
 
I would write a routine in VB to read in the txt file one line at a time, parse it (the VB SPLIT function is good for this) and insert each field acoring to logic rules as the file is read in.
 
Thanks for replies,

gbzrope.i will appreciate if you give little sample or if you write code for this, i do not know too much about VB but i know vb can solve this problem. I hope you will help me for that.

CCLINT, I know select into will do that but how to get information from TXT file and how i can put checks that this line (record)is finished here and now go to next record in TXT file, please if you write in little detail, it will be helpfull.

Thanks for replies.

Knowledge is a key of success.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top