on 2017 Jun 27 10:41 AM
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?
Request clarification before answering.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
AFAIK, v10 introduced the DEFAULTS ON/OFF clause, so the basic INSERT ON EXISTING UPDATE clause should be way older.
User | Count |
---|---|
54 | |
6 | |
6 | |
5 | |
5 | |
5 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.