All Forums Database
20 Jan 2006
IMPORT DATA WITH USING (variable)

We need to make a BTEQSQL with the command “EXPORT REPORT” using a variable that contain the name file that we must use and generate.Following, we explain the SQL with the syntax USING to recuperate the name file that is used to export data..IMPORT DATA FILE = 'TEST.DAT';USING ROOT (CHAR (20)), CODE (CHAR(2)).EXPORT DATA FILE =:ROOT;SELECT NAMEFILE FROM DATABASE.USERS WHERE CODE=:CODE;.EXPORT RESETBut this solution isn't write because we can't used the syntax USING. Another solution?

hh 21 posts Joined 06/04
24 Jan 2006

I am not sure this will work but have you try putting those values from a file into a teradata table and use the table to drive your file name?

robirob44 3 posts Joined 08/06
29 Aug 2006

Hi all,I also have a problem with an IMPORT.my IMPORT looks like :.IMPORT VARTEXT '|' FILE "test_export.del", SKIP=1.REPEAT *USING I don't know ???INSERT INTO TableNameVALUES I don't know ???;.LOGOFFI don't want to describe my table "TableName" in the USING and in the VALUES, like :.IMPORT VARTEXT '|' FILE "test_export.del", SKIP=1.REPEAT *USING (COETB CHAR(3) ,COEM CHAR(7), CTEM CHAR(3))INSERT INTO TableNameVALUES(:COETB, :COEM, :CTEM);Is someone can help me ?Thanks

Fred 1096 posts Joined 08/04
30 Aug 2006

For the export, do it in two steps.IMPORT DATA FILE = 'TEST.DAT';.EXPORT DATA FILE = 'WORK.TXT';USING ROOT (CHAR (20)), CODE (CHAR(2))SELECT '.EXPORT DATA FILE ='||:ROOT||';' (CHAR(255));SELECT 'SELECT NAMEFILE FROM DATABASE.USERS WHERE CODE='''||:CODE||''';' (CHAR(255)).EXPORT RESET.RUN FILE='WORK.TXT';.EXPORT RESET

You must sign in to leave a comment.