[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: truncated value when doing table insert



Check the flat file...is there a break or special character in the value
'President-Murray'.  Since you have values as long as this,length
considerations are out.  The show statement is not exceptional.  Thus logic
says it is a data problem?

-----Original Message-----
From: Nenneman, Daniel [mailto:DNENNEMAN@PLATO.COM]
Sent: Wednesday, April 03, 2002 2:50 PM
To: SQR-USERS@list.iex.net
Subject: truncated value when doing table insert


Hi,

I'm running into a strange problem.  I'm doing a straightforward read from a
flat file and then inserting into a database table.  When I look at the
results in the table however, approximately 4 of the 118 rows have truncated
values.  I.E. "Client Relations" becomes "Client Rel".

I'm using
 - SQR for PeopleSoft/8.16.02/PC/Windows NT 4.0/ODBC Level 2/Dec 11 2001
 - Windows 2000 and MS SQL Server

A simplified version of the code I'm using is ...

1) I create a table
  Create Table Temp_Name
  (
   Deptid    char(6) null,
   Name     char(30) null
  )

2) Read in the values from the flat file
    Read 10 Into $Record:80
    let $DEPTID     = substr($Record, 5, 6)
    let $DESCR      = substr($Record, 12, 30)
    show $Record
    show 'Inserting ' $DEPTID '*' $DESCR '*'

3) Do an Insert into the table
   insert into Temp_Name values ($DEPTID, $DESCR)

4) I get the following SHOW statement results in the log file

MRR     404010  Accounting-Murphy
Inserting 404010*Accounting-Murphy*
FWX     404020  COO
Inserting 404020*COO*
ACE     404030  President-Murray
Inserting 404030*President-Murray*
FWX     404040  President & Ceo
Inserting 404040*President & Ceo*

5) When I look at the table via query-analyzer, I get the following

DeptId   Name
---------- ------------------------------
404010 Accounting-Murphy
404020 COO
404030 Pre
404040 President & Ceo


Does anyone know why the value 'President-Murray' would get truncated to
'Pre' in the database
table?  I'm not getting any SQL errors.  Anyone have any thoughts on what to
try?  I've run out of ideas
at this point.

Thanks in advance,

Daniel Nenneman
HRMS Analyst\Developer
dnenneman@plato.com
PLATO Learning, Inc.