dbTalk Databases Forums  

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

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss How to import a arbitrary CSV file from command line into SQL Server or Oracle in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Karen Middleton
 
Posts: n/a

Default How to import a arbitrary CSV file from command line into SQL Server or Oracle - 10-07-2004 , 12:04 AM






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
Karen

Reply With Quote
  #2  
Old   
Ilya Margolin
 
Posts: n/a

Default Re: How to import a arbitrary CSV file from command line into SQL Server or Oracle - 10-07-2004 , 07:15 AM






Karen,

Look up BCP utility in BOL.

Ilya

"Karen Middleton" <karenmiddleol (AT) yahoo (DOT) com> wrote

Quote:
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
Karen



Reply With Quote
Reply




Thread Tools
Display Modes

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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.