Click to See Complete Forum and Search --> : Converting a text file to a database


gknierim
January 28th, 2000, 08:40 AM
I hope someone could give me a sense of direction on this one. I have a text file that is tab delimited and I need to read this text file and put each item I read into a database. I also need to know what kind of format the VB app that I am writing should be in? ActiveX exe? Regular exe? etc as the VB program will run behind the scenes, so there will be no interface for it.

I will be using SQL Server as my database tool and I am using VB6 to write my code. Any help would be greatly appreciated!

Lothar Haensler
January 28th, 2000, 08:56 AM
I would NOT write a VB app.
use the SQL Server tools to load your file, e.g. the bulk copy program (BCP) or DTS if you sqlserver is version 7 and above.

gknierim
January 28th, 2000, 09:13 AM
Thanks, that sounds what I'm looking for but I'm not familiar with SQL Server all that much. I currently have a VB app that is already running and I was just going to make this new function a part of it. Since this app is running all the time, it will look for these text files every 5 minutes and put them in the database. Can VB call a SQL Server function to do this?

Sorry for making this long winded. P.S. I currently have 6.5 but I will have Ver 7.

Lothar Haensler
January 28th, 2000, 09:17 AM
several solutions:
- use VB's Shell command to start the BCP-Utility
- use SQLDMO Komponent to programmatically invoke a BulkCopy process
- use ADO (activex Data objects) to connect to the database and do your inserts via the ADO object model (involves the most work).