Skip to Content
0
Apr 29, 2015 at 02:18 AM

sql anywhere 11 input from file problem

30 Views

the input file has 4 columns separated by tab and is like

USD 2006-04-26 0.8873 0.85

USD 2006-04-27 0.8901 0.85

USD 2006-04-28 0.8926 0.86

numeric value has up to 4 decimal places and 4 digits to the left of the decimal. the actual file has more than 2000 rows

I tried following the syntax in the Sybooks online documentation but

Could not execute statement.

Syntax error near 'input' on line 11

SQLCODE=-131, ODBC 3 State="42000"

Line 1, column 1

begin

create table #T

("Currency" VARCHAR(4) NOT NULL,

"Cnv_dt" DATE NOT NULL,

"Cnv_Rate" DECIMAL(10,4) NOT NULL,

"NoonRate" DECIMAL(10,4) NULL

,CONSTRAINT PRIMARY KEY ( "Currency" ASC, "Cnv_dt" ASC )

);

input into #T

--("Currency", /// also tried with column name

-- "Cnv_dt" ,

-- "Cnv_Rate" ,

-- "NoonRate"

-- )

delimited by '\t' escapes off format text

from '%tmp%\BocXchgRate.txt' nostrip // also tried somehting like form c:\\\users\\me\\appdata\\tmp\\BocXchgRate.txt no strip

;

select * from #T;

end

what mistake did I make causing ODBC error?

I did not write the ODBC "USING connection-string FROM source-table-name" clause

I tried also

input into #T by order

delimited by ' ' escapes off format text

from C:\\Users\\g2\\AppData\\Local\\Temp\\BocXchgRate.txt nostrip

;

I also tried prompt in place of from ...