cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Insert on existing update from select

Former Member
2,087

Hi felows,

I Have a script, collecting data from several tables, it takes long time to run, I created a single table that have just the information I need, I want to create a procedure, to run every day (with cron), to update this table.
This way above, works, I tested:
"insert into new_table (var1, var2,var3...) select var1, var2, var3... from other_table where..."
but I tried to do this using "on existing update" and the ISQL give me the error. "Remote server does not the ability to support this statement"
I couldn't find anything related on forums or Sybase KB.
There is some way to do what I want ?
Thanks a lot
Paulo Braga - Brazil

Accepted Solutions (0)

Answers (1)

Answers (1)

VolkerBarth
Contributor
0 Likes

AFAIK, the ON EXISTING clause does not work when the source table (SELECT FROM) or the destination table (INSERT INTO) are proxy tables, as documented here - although the documentation just mentions the destination table.

My typical workaround is a two-step approach:

  1. SELECT the proxy's table relevant contents into a local temporary table (so via the SELECT ... INTO LOCAL TEMPORARY TABLE... syntax)
  2. Use your original INSERT ... ON UPDATE... SELECT FROM LT..., i.e. selecting from the local temporary table from step 1. As the local temporary table and the destination table are both local, the ON UPDATE clause should work.