1

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.

Daria
  • 861
  • 11
  • 29
  • Check out this question: http://stackoverflow.com/questions/19299244/how-to-resolve-update-operation-attempted-on-non-updatable-query – default locale Jan 13 '15 at 08:32
  • 1
    This question doesn't solve problem. And sure I read the explanation at sybase site, but I need to update my table any way – Daria Jan 13 '15 at 08:36
  • Is your table a remote table? – frlan Jan 13 '15 at 09:11
  • I'm connecting to a sybase iq server by host:port, I guess table is not remote for a server, maybe it's remote for me (for my local machine)? – Daria Jan 13 '15 at 09:34

2 Answers2

0

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

Daria
  • 861
  • 11
  • 29
0

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'

Orhan Celik
  • 1,513
  • 15
  • 12