BTEQ 2673 - Source Parcel Length Error

Tools & Utilities

BTEQ 2673 - Source Parcel Length Error

I have read through a bunch of the topics on this, and have yet to find the issue. So here is my issue. I can import the file via SQL Assistant without issue, so the table and data match each other fine. But BTEQ keeps giving me this error and I don't understand why.

 

Script:

bteq;
.set sessions 1
.logmech LDAP
.logon server/,,
.SET QUIET ON
DELETE FROM db.table;
.IMPORT VARTEXT '|' FILE = H:\SampleFile.txt
.REPEAT *
USING ( Field1 INT
  ,Field2 INT
  ,Field3 INT
  ,Field4 varchar(16)
  ,Field5 varchar(16)
  ,Field6 CHAR(1)
  ,Field7 INT
  ,Field8 varchar(100)
  ,Field9 varchar(50)
  ,Field10 date
  ,Field11 date
  ,Field12 varCHAR(50) 
  ,Field13 int
  ,Field14 int
  ,Field15 date
  ,Field16 VARCHAR(23)
  )
INSERT INTO db.table (
	Field1
		,Field2
		,Field3
		,Field4
		,Field5
		,Field6
		,Field7
		,Field8
		,Field9
		,Field10
		,Field11
		,Field12
		,Field13
		,Field14
		,Field15
		,Field16)
  VALUES(
	:Field1
	,:Field2
	,:Field3
	,:Field4
	,:Field5
	,:Field6
	,:Field7
	,:Field8
	,:Field9
	,CAST(:Field10 AS DATE FORMAT 'yyyy-mm-dd')
	,CAST(:Field11 AS DATE FORMAT 'yyyy-mm-dd')
	,:Field12
	,:Field13
	,:Field14
	,CAST(:Field15 AS DATE FORMAT 'yyyy-mm-dd')
	,:Field16
	);
	
TE SET TABLE db.table ,NO FALLBACK ,
     NO BEFORE JOURNAL,
     NO AFTER JOURNAL,
     CHECKSUM = DEFAULT,
     DEFAULT MERGEBLOCKRATIO
     (
      Field1 INTEGER,
      Field2 INTEGER,
      Field3 INTEGER,
      Field4 VARCHAR(16) CHARACTER SET LATIN NOT CASESPECIFIC,
      Field5 VARCHAR(16) CHARACTER SET LATIN NOT CASESPECIFIC,
      Field6 CHAR(1) CHARACTER SET LATIN NOT CASESPECIFIC,
      Field7 INTEGER,
      Field8 VARCHAR(100) CHARACTER SET LATIN NOT CASESPECIFIC,
      Field9 VARCHAR(50) CHARACTER SET LATIN NOT CASESPECIFIC,
      Field10 DATE FORMAT 'yyyy-mm-dd',
      Field11 DATE FORMAT 'yyyy-mm-dd',
      Field12 VARCHAR(50) CHARACTER SET LATIN NOT CASESPECIFIC,
      Field13 INTEGER,
      Field14 INTEGER,
      Field15 DATE FORMAT 'yyyy-mm-dd',
      Field16 VARCHAR(23) CHARACTER SET LATIN NOT CASESPECIFIC)

Sample data:

123|456|789|1234567901234|1234567901234|S|130|Something here|Something there |2018-04-09|2018-04-07|something else here also|12345|123456|2018-05-08|abcdefghijklmnopqrstuvw

Accepted Solutions
Junior Contributor

Re: BTEQ 2673 - Source Parcel Length Error

VARTEXT means only VarChar input, no INT or DATE

USING ( Field1 varchar(11)
  ,Field2 varchar(11)
  ,Field3 varchar(11)
  ,Field4 varchar(16)
...

Those VarChars will automatically be casted to INT/DATE during the Insert, only if there's a non-standard format you must CAST explicitly.

1 ACCEPTED SOLUTION
2 REPLIES
Junior Contributor

Re: BTEQ 2673 - Source Parcel Length Error

VARTEXT means only VarChar input, no INT or DATE

USING ( Field1 varchar(11)
  ,Field2 varchar(11)
  ,Field3 varchar(11)
  ,Field4 varchar(16)
...

Those VarChars will automatically be casted to INT/DATE during the Insert, only if there's a non-standard format you must CAST explicitly.

Re: BTEQ 2673 - Source Parcel Length Error

I used to do it that way and it was scripted that way and that wasnt working either, but now it is working fine. I must have had something wrong the first time. Thanks for the response..