2012-01-24 2 views
1

Im пытаясь скопировать данные из одной таблицы в другую в той же базе данных db2, используя следующую команду:DB2: Вставить в столбец типа данных st_Geometry, из столбца типа varchar?

INSERT INTO SCH.TAB1 (SOMEPK, GEOM) 
SELECT SOMEPK, db2gse.ST_Geometry(GEOM) FROM SCH.TAB2 

В 2 таблицы идентичны за исключением того, что колонки TAB2 GEOM имеет тип данных st_geometry в то время как тот же столбец в TAB1 является VAR-CHAR, однако я хочу, чтобы преобразовать данные в GEOM колонки из текста в формат st_geometry, когда я копирование поперек, но я получаю следующее сообщение об ошибке:

SQL0408N A value is not compatible with the data type of its assignment target. Target name is "GEOM               ". 

Explanation: 

The data type of the value to be assigned to the column, parameter, SQL 
variable, or transition variable by the SQL statement is incompatible 
with the declared data type of the assignment target. 

The statement cannot be processed. 

User response: 

Examine the statement and possibly the target table or view to determine 
the target data type. Ensure the variable, expression, or literal value 
assigned has the proper data type for the assignment target. 

For a user-defined structured type, also consider the parameter of the 
TO SQL transform function defined in the transform group for the 
statement as an assignment target. 

sqlcode: -408 

ответ

Смежные вопросы