1

我在 DB2 中有数据,然后我想将该数据插入 SQL。

我拥有的 DB2 数据如下:

select char('AAA   ') as test from Table_1

但是,当我在插入后在 SQL 中选择时,数据变成了这样。

select test from Table_1

结果 :

test
------
AAA

为什么空格字符读入框字符。我该如何解决这个问题,以便读入空格字符。

还是我需要更改设置?还是我必须使用参数?

我使用了 AS400 和 datastage。

谢谢你。

4

2 回答 2

1

Datastage 会附加填充字符,以便您知道那里有空格。默认情况下,填充字符为 0x00 (NUL),这就是您所看到的。

研究 APT_STRING_PADCHAR 环境变量;如果需要,您可以将其设置为其他内容。

0x00 字符实际上不在您的数据库中。简短的回答是,您可以放心地忽略它。

于 2014-06-26T08:02:14.357 回答
0

When you said:

select char('AAA   ') as test from Table_1

You were not actually showing any data from the table. Instead you were showing an expression casting a constant AAA as a character value, and giving that result column the name test which coincidentally seems to be the name of a column in the table, although that coincidence doesn't matter here.

Then your 2nd statement does show the contents of the database column.

select test from Table_1

Find out what the hexadecimal value actually is.

于 2014-06-27T05:15:15.240 回答