Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 27759

Updating data in a table for multiple records from a file using Import - response (5) by thisisKumar

$
0
0

Thanks, Dieter. I think I got the solution.
for this I have created the temporary table and imported data from a file 
then by using this temporary table I am updating the actual table using MERGE INTO
 

Step 1: CREATE GLOBAL TEMPORARY TABLE abc  -- This is exactly same as original table

 (cust_ky INTEGER, fname VARCHAR(30), lname VARCHAR(50)) 

ON COMMIT PRESERVE ROWS;

 

Step 2: In SQLA set the delimiter to the correct char (in tools - options - export/import)
Step 3: then imported data from a file. (created few sample records in a file)
INSERT INTO abc (cust_ky, fname,lname) VALUES (?,?,?)
Step 4: Updated my actual table using MERGE INTO
 

MERGE INTO myDEVschema.kumar_TEST USING (SEL cust_ky, fname, lname FROM abc)AS kk(a,b,c)

ON cust_ky=kk.a

WHEN MATCHED THEN 

UPDATE

SET fname=kk.b

,lname=kk.c

WHEN NOT MATCHED THEN

INSERT VALUES(kk.a,kk.b,kk.c)

 

this is all using SQLA only.


Viewing all articles
Browse latest Browse all 27759

Trending Articles