Importing flat files to database
Posted in 1999
Topics: General Discussion
I have a flat file that is currently colon delimited (can be changed with regex easily). I need to import this flat file into a table. Is there a utility, or script that will do this for me? I've thought about just using coldfusion server with <cfloop> but that doesn't seem like it would be the best,or most efficient. Also, how would you go about exporting a database to a flat file that is delimited with some character? Any information, or references would be greatly appreciated. Sent via Deja.com http://www.deja.com/ Before you buy.
In dbaccess use the dbaccess LOAD command:
LOAD FROM 'somefile' DELIMITER ':' INSERT INTO sometable;
Or use dbload. You will need to write a commandfile but for larger loads it
is faster than dbaccess and can do partial commits so you do not blow the
lock table.
Simple dbload commandfile:
#########################################
FILE 'somefile' DELIMITER ':' x; #Where x is the number of fields in file
INSERT INTO sometable;#########################################
Art S. kagel
aginsberg@safeconnect.net wrote:
>
> I have a flat file that is currently colon delimited (can be changed
> with regex easily). I need to import this flat file into a table. Is
> there a utility, or script that will do this for me? I've thought
> about just using coldfusion server with <cfloop> but that doesn't seem
> like it would be the best,or most efficient. Also, how would you go
> about exporting a database to a flat file that is delimited with some
> character? Any information, or references would be greatly appreciated.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
In article <84ejth$r3b$1@nnrp1.deja.com>, aginsberg@safeconnect.net wrote: > I have a flat file that is currently colon delimited (can be changed > with regex easily). I need to import this flat file into a table. Is > there a utility, or script that will do this for me? I've thought > about just using coldfusion server with <cfloop> but that doesn't seem > like it would be the best,or most efficient. Also, how would you go > about exporting a database to a flat file that is delimited with some > character? Any information, or references would be greatly appreciated. A generic parser/converter like ParseRat (http://www.guysoftware.com/parserat.htm) can turn a colon-delimited file (or any delimiter, for that matter) into a file with any other delimiter or into a dBase (*.DBF) file which pretty much anything can import directly. Sent via Deja.com http://www.deja.com/ Before you buy.
Use the utility "dbimport". There is an environment variable for the
delimiter. Dbexport does the opposite. Use the -ss option.
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!