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 > Import in SP

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-23-04, 09:03
achiola achiola is offline
Registered User
 
Join Date: May 2002
Location: General Deheza, Cba, Arg.
Posts: 273
Import in SP

hi,
I want create a SP for import a txt file in a table, but, not sure how?.

The db2level is 8.1.5 in win2000.

this is a "example" but no work!!:

CREATE PROCEDURE DB2INST1.CREDITOS_IMPORT ( IN ARCHIVO VARCHAR(256))
------------------------------------------------------------------------
-- SQL Stored Procedure
-- Descripcion: cargar archivos de texto a una tabla temporal.
------------------------------------------------------------------------
P1: BEGIN

IMPORT FROM ARCHIVO OF ASC METHOD L (1 4000) NULL INDICATORS (0) MESSAGES C:\MSG.MSG;

END P1



any idea.
TIA
Abel.
Reply With Quote
  #2 (permalink)  
Old 11-23-04, 09:33
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
IMPORT is a DB2 command and not SQL. Only SQL can be used in SQL Stored Procedures.

Andy
Reply With Quote
  #3 (permalink)  
Old 11-23-04, 09:52
achiola achiola is offline
Registered User
 
Join Date: May 2002
Location: General Deheza, Cba, Arg.
Posts: 273
thanks.

any other idea?
Reply With Quote
  #4 (permalink)  
Old 11-23-04, 10:07
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
All I can think of, if you want to have a SP import data to a table from a flat file is to do the work yourself. You could do this by writing the SP in another language (e.g. java), or come up with another way. This article maight help with an alternative (I have not had a chance to actually go through it):

http://www-128.ibm.com/developerwork...0302izuha.html

HTH

Andy
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