ID Number: Q80627
1.10 1.11
OS/2
buglist1.10 buglist1.11 fixlist1.19
Summary:
Problem ID: PRSQL9201007
SYMPTOM
If the "file_collen" parameter of the bulk copy function
bcp_colfmt() is set to a value that is less than the actual data
in the table's column, the output file does not contain the
expected truncated data. This problem occurs when no field
terminator sequence or prefix length is specified. For example,
when using a table that is defined as follows
create table test(c1 char(5), c2 varchar(5), c3 char(5))
insert test values ("abcd","abcd","abcd")
the following code fragment
bcp_colfmt(dbproc, column_number, SQLCHAR, 0, 1, NULL, -1, 1)
gives an output file containing the following:
abcd.abcdabcd. (where . represents a blank space)
However, the expected output is:
aaa
CAUSE
This problem occurs because the file_collen parameter for
bcp_colfmt is not correctly interpreted. If file_collen is some
positive value, the system should use file_collen to determine the
maximum data length. This should occur in either case when the
field terminator (or prefix length) is specified and file_collen
specifies a value resulting in the shorter amount of data being
copied, or when no field terminator (or prefix length) is
specified.
WORKAROUND
Use BCP (the bulk copy program) and specify the desired size of
columns.
STATUS
Microsoft has confirmed this to be a problem in SQL Server versions
1.1 and 1.11. This problem was corrected in version 1.19 of
DB-LIBRARY (db-lib), which is available from Microsoft Product
Support Services. For more information, contact your primary
support provider.
Additional reference words: 1.10 1.11 dblib