SQL Anywhere Error -728: Update operation attempte

2019-08-01 15:55发布

What I'm trying to do:

update table_name set field2 = substring(REGEXP_SUBSTR(field1, 'item=[0-9]+', charindex('item=', field1)), 6)

But I'm getting

SQL Anywhere Error -728: Update operation attempted on non-updatable remote query

Can I solve it somehow? I don't use local/remote tables. I use one table.

2条回答
地球回转人心会变
2楼-- · 2019-08-01 16:04

So I guess I found soltion... even 2. Unfortunately still no way to use REGEXP_SUBSTR... I do:

first

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;

or

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

Something like this

查看更多
趁早两清
3楼-- · 2019-08-01 16:21

I suggest to double check that table_name is actually a table, but not a view. If it is a view, you may see its definition with sp_helptext command, such as

sp_helptext 'view_name'

or

sp_helptext 'schema_name.view_name'

查看更多
登录 后发表回答