cancel
Showing results for 
Search instead for 
Did you mean: 

UPDATE or INSERT in ASA 9.0.2.3951

0 Kudos
2,507

I'm writing an application to move data to Sybase and need to perform update / insert operations. In Firebird, I'd use UPDATE OR INSERT (a single statement exemple :

UPDATE OR INSERT INTO TABLES (PK, TABLE) VALUES (PK, TABLE)

But it doesn't seem to be available in Sybase. I know this can be done with multiple statements, but for a couple of reasons, I'm really trying to get this into a single statement.

Any suggestions?

Accepted Solutions (1)

Accepted Solutions (1)

regdomaratzki
Product and Topic Expert
Product and Topic Expert

INSERT INTO t1(pk, c1) ON EXISTING UPDATE VALUES ('1', 'reg')

Just curious, but SQL Anywhere v9.0.2 has been end-of-lifed for quite some time. Did you consider using a version of SQL Anywhere that is more recent? We're currently at v17.

Reg

Answers (1)

Answers (1)

MarkCulp
Participant

Take a look a the INSERT ... ON EXISTING UPDATE statement in the docs (link is to v10.0.1 docs... so not sure if this is in v9?). This should do what you are wanting to do.

VolkerBarth
Contributor

AFAIK, v10 introduced the DEFAULTS ON/OFF clause, so the basic INSERT ON EXISTING UPDATE clause should be way older.