我正在尝试做的事情:
update table_name set field2 = substring(REGEXP_SUBSTR(field1, 'item=[0-9]+', charindex('item=', field1)), 6)
但我越来越
SQL Anywhere Error -728: Update operation attempted on non-updatable remote query
我能以某种方式解决它吗?我不使用本地/远程表。我用一张桌子。
我正在尝试做的事情:
update table_name set field2 = substring(REGEXP_SUBSTR(field1, 'item=[0-9]+', charindex('item=', field1)), 6)
但我越来越
SQL Anywhere Error -728: Update operation attempted on non-updatable remote query
我能以某种方式解决它吗?我不使用本地/远程表。我用一张桌子。
所以我想我找到了解决方案......甚至2。不幸的是仍然没有办法使用REGEXP_SUBSTR......我这样做:
第一的
alter table my_table add item_position int null
alter table my_table add is_char int null
alter table my_table add item_part varchar(200) null
alter table my_table add item bigint null
update my_table set item_position = charindex('item=', field1)+5;
update my_table set item_part = substring(field1, item_pos, 10);
update my_table set is_char = charindex('&', clid_part)-1;
update my_table set item = case when is_char = -1 then item_part else substring(item_part, 1, charindex('&', item_part)-1) end;
或者
cast(str_replace(substring(field1, charindex('item=', field1)+5, 10), substring(substring(field1, charindex('item=', field1)+5, 10),
(charindex('&', substring(field1, charindex('clid=', field1)+5, 10)))), '') as integer) as item
像这样的东西
我建议仔细检查 table_name 实际上是一个表,而不是一个视图。如果是视图,可以用 sp_helptext 命令看到它的定义,比如
sp_helptext 'view_name'
或者
sp_helptext 'schema_name.view_name'