If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > SP for importing a flat file

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-28-09, 05:13
manojsrec manojsrec is offline
Registered User
 
Join Date: Jan 2009
Posts: 1
Thumbs up SP for importing a flat file

Hi,

I am new to db2. Can anyone help me out to create a stored procedure to import a csv file to existing database.

I used this command and its working fine.

import from 'C:\test1.csv' of del
insert into det1 (name,age,salary)

Now i need to write a sp for this. How to do this??

I appreciate you kind help.

thanks,
Manoj
Reply With Quote
  #2 (permalink)  
Old 01-28-09, 05:34
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
have a look at the documentation for ADMIN_CMD command for your version of the database. If IMPORT is supported, you can call this procedure from your SP to do the import. HTH
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 01-28-09, 08:34
rahul_s80 rahul_s80 is offline
Registered User
 
Join Date: Jul 2006
Location: Pune , India
Posts: 433
i think it picks 'C:\test1.csv' from the server path even if you are calling the admin_cmd from client
__________________
Rahul Singh
Certified DB2 9 DBA / Application Developer
Reply With Quote
  #4 (permalink)  
Old 01-29-09, 07:38
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
yes!!!! All Stored Procs runs on the server

Quote:
Originally Posted by rahul_s80
i think it picks 'C:\test1.csv' from the server path even if you are calling the admin_cmd from client
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On