Karen,  the following is the code I use to upload a CSV file into my database.  I save the file each time with the same name and the program does the rest.
 
*(UPld_DOO.cmd                                  01/08/05)
*(File transfer for Daily Out of Stock report )
*(Uploads data for counting the number days )
*(item is considered to be on the daily out of )
*(stock report)
*(Updated 01/17/05 to reset daily daily table based on date)
*(of data being uploaded.  Friday day will reset daily table)
*(******************************************************)
 
*(Enter the parameters for the PO Receiving)
SET ERROR MESSAGES OFF
DIALOG 'Enter WMWeek of Daily Out of Stock Report' vweek vlast 1
IF vlast = '[ESC]' THEN
  GOTO endprg
ENDIF
SET VAR vweek INTEGER
 
PAUSE 3 USING 'PLEASE WAIT WHILE PROCESSING'
 

*(I project a temporary table into which I load the data)
*(I never load the data into my permanent table first)
PROJECT TEMPORARY dailyoo FROM instk_doo USING item_no,dcno,oodate WHERE LIMIT = 0
*(Load the PO Receiving data into temporary table)
SET VAR vdir = (CVAL('currdir'))
SET VAR vfil = (.vdir + '\Data\dailyoostk.csv')
 
LOAD dailyoo FROM &vfil AS CSV
IF SQLCODE < 0 THEN
  CLS
  PAUSE 2 USING 'DailyOOStk.csv' CAPTION 'DID NOT LOAD'
  GOTO endprg
ENDIF
SELECT oodate INTO vodat FROM dailyoo
ALTER TABLE dailyoo ADD wmweek INTEGER
UPDATE dailyoo SET wmweek = .vweek
DELETE ROWS FROM dailyoo WHERE item_no IS NULL
 
SWITCH (TDWK(.vodat))
  CASE 'Friday'
    APPEND dailyoo TO instk_doo
    CREATE TEMPORARY VIEW dailysum(item_no,dcno,nodays,wmweek) +
    AS SELECT  +
    item_no,dcno, +
    COUNT(oodate) +
    wmweek +
    FROM instk_doo +
    GROUP BY item_no,dcno,wmweek +
    ORDER BY item_no
    APPEND dailysum TO instk_wkoo
    DELETE ROWS FROM instk_doo
    BREAK
  DEFAULT
    APPEND dailyoo TO instk_doo
    BREAK
ENDSW
 
DROP TABLE dailyoo
DROP VIEW dailysum
 
LABEL endprg
 
CLEAR VAR vweek,vlast,vodat,vfil,vdir
 
CLS
SET ERROR MESSAGES ON
RETURN
 
----- Original Message -----
Sent: Friday, October 28, 2005 2:28 PM
Subject: [RBG7-L] - Re: Import from Excel - extra info

That's what I did.  In my destination table, I made the column a TEXT
type, thinking it would bring the date in, just looking like a text value,
but that's when it brought it in with these integers.  Is that what you meant?
I don't want to have the users bring the spreadsheet up and change the
format there to something else.

Karen



Karen, one way to do this is to import the date as a text value, and
convert later.


Reply via email to