Subject | Invert two columns |
---|---|
Author | Pierre Y. |
Post date | 2003-10-29T14:39:49Z |
Hello,
What should append after this request ?
UPDATE TEST SET
V2=V1,
V1=V2
Here the copy of execution of such a script (not mine... I stole it to another FB user) in a DOS console :
C:\temp>type tst.sql
CREATE DATABASE 'test.gdb' USER 'SYSDBA' PASSWORD 'masterkey';
CREATE TABLE TEST (
V1 INTEGER,
V2 INTEGER
);
COMMIT;
INSERT INTO TEST VALUES (1, 2);
INSERT INTO TEST VALUES (3, 4);
COMMIT;
SELECT * FROM TEST;
UPDATE TEST SET V1=V2, V2=V1;
COMMIT;
SELECT * FROM TEST;
DROP DATABASE;
C:\temp>isql -i tst.sql
Use CONNECT or CREATE DATABASE to specify a database
V1 V2
============ ============
1 2
3 4
V1 V2
============ ============
2 2
4 4
Do I missed something or this is the right way ?
Regards,
Pierre
What should append after this request ?
UPDATE TEST SET
V2=V1,
V1=V2
Here the copy of execution of such a script (not mine... I stole it to another FB user) in a DOS console :
C:\temp>type tst.sql
CREATE DATABASE 'test.gdb' USER 'SYSDBA' PASSWORD 'masterkey';
CREATE TABLE TEST (
V1 INTEGER,
V2 INTEGER
);
COMMIT;
INSERT INTO TEST VALUES (1, 2);
INSERT INTO TEST VALUES (3, 4);
COMMIT;
SELECT * FROM TEST;
UPDATE TEST SET V1=V2, V2=V1;
COMMIT;
SELECT * FROM TEST;
DROP DATABASE;
C:\temp>isql -i tst.sql
Use CONNECT or CREATE DATABASE to specify a database
V1 V2
============ ============
1 2
3 4
V1 V2
============ ============
2 2
4 4
Do I missed something or this is the right way ?
Regards,
Pierre