2011/12/30

USE SQL ASSISTANT TO CREATE A TABLE WITH A TIMESTAMP COLUMN BUT THE COLUMN WAS CONVERTED TO CHAR(23)

we found that when we create a table using SQL assistant, and define the column as

HNKO_TIME TIMESTAMP(0)

the create table statement was successd but when we show the created table we found that it was defined in

HNKO_TIME CHAR(23) CHARACTER SET UNICODE NOT CASESPECIFIC,

thanks to the Teradata forums
http://forums.teradata.com/forum/database/cast-string-to-time
http://forums.teradata.com/forum/enterprise/timestamp-interval-not-working-in-batch-jcl-but-works-in-sql-assistant

and now we know that it was because of the  "allow use of odbc extensions" option in sql assistant
unchecked it ,and problem  is resolved

it seems that that if the option is checked, odbc driver will parse the sql query.
any way, the most important thing is , create table ,and never forget to check the definition of the table created . make sure what you created is what you wanted


最近发现,在某台机器上,通过SQL Assistant提交的DDL,如果包含有TIMESTAMP定义的字段,会被置换为CHAR(23),这显然不正确。
罪魁祸首是老旧版本的SQL Assistant中的设置项:allow use of odbc extensions。
如果选中此选项,ODBC驱动看起来会将某些查询解析掉,譬如说DDL中的TIMESTAMP定义。

No comments:

Post a Comment