all groups > sql server programming > october 2004 >
You're in the

sql server programming

group:

How to import a arbitrary CSV file from command line into SQL Server or Oracle


How to import a arbitrary CSV file from command line into SQL Server or Oracle karenmiddleol NO[at]SPAM yahoo.com
10/6/2004 10:04:14 PM
sql server programming:
I have a CSV file with the first row in the CSV file to be the column
headers.

The file is as follows:


Material, Customer, month,qty, sales
10000,19ABC, 122004, 90.5, 10000
20000,20ABC, 122004, 80.5, 12000
30000,21ABC, 122004, 70.5, 14000
40000,22ABC, 122004, 60.5, 16000
50000,23ABC, 122004, 50.5, 18000

I want to import this file from DOS command prompt command line into
SQL Server or Oracle table.

I am aware of tools like Bulk Insert in SQL Server or sqlloader in
Oracle to import these files into the database but I want something
simple to
run from a command line given the database, table name, server
name,etc can import this file by a make table into a Oracle or SQL
Server table I want this to be preferably done from a VB ADO script
(WSH script) run from command line.

Also, if possible I want to set a command line option to insert into
the target table if existing rather than creating it.

Can somebody please share a ADO VBscript that given the DSN can import
a CSV file with column headers into a SQL or Oracle database please
note I do not want to use DTS i want to import a arbitrary csv file
with a VBScript file into a Oracle or SQL database.

Thanks
Re: How to import a arbitrary CSV file from command line into SQL Server or Oracle Ilya Margolin
10/7/2004 8:15:15 AM
Karen,

Look up BCP utility in BOL.

Ilya

[quoted text, click to view]

AddThis Social Bookmark Button