![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 5 of 5 total |
![]() |
Sun, Mar 22 2009 2:51 PM | Permanent Link |
"Malcolm" | I have finally worked out the syntax for updating a single column in
a table in one database from a column in a table in another database... So is it possible and if so what is the syntax to update 2 or more columns in a single statement? Or am I stuck with a statement per column? ... set (cola, colb) = select (colx, colz ....) Malcolm -- |
Mon, Mar 23 2009 4:18 AM | Permanent Link |
Uli Becker | Malcolm
> So is it possible and if so what is the syntax to update 2 or more > columns in a single statement? That should be no problem: I use this code in a procedure e.g.: Prepare UpdateStatement from 'update Statistik2C s set M1 = (select Alle from temp t where t.jahr = s.jahr and t.monat = 1), M2 = (select Alle from temp t where t.jahr = s.jahr and t.monat = 2), M3 = (select Alle from temp t where t.jahr = s.jahr and t.monat = 3), M4 = (select Alle from temp t where t.jahr = s.jahr and t.monat = 4), M5 = (select Alle from temp t where t.jahr = s.jahr and t.monat = 5), M6 = (select Alle from temp t where t.jahr = s.jahr and t.monat = 6), M7 = (select Alle from temp t where t.jahr = s.jahr and t.monat = 7), M8 = (select Alle from temp t where t.jahr = s.jahr and t.monat = 8), M9 = (select Alle from temp t where t.jahr = s.jahr and t.monat = 9), M10 = (select Alle from temp t where t.jahr = s.jahr and t.monat = 10), M11= (select Alle from temp t where t.jahr = s.jahr and t.monat = 11), M12 = (select Alle from temp t where t.jahr = s.jahr and t.monat = 12)'; EXECUTE UpdateStatement; Uli |
Mon, Mar 23 2009 7:59 AM | Permanent Link |
Fernando Dias ![]() | Malcolm,
> So is it possible and if so what is the syntax to update 2 or more > columns in a single statement? It's possible using one subquery for each column you want to update, as Uli indicated. > .. set (cola, colb) = select (colx, colz ....) Currently EDB doesn't support ROW values, but it will in version 2.03. I don't know if Tim is going to change the INSERT statement syntax in the initial 2.03 build but if that is the case then we will be able to use that kind of set clause. Let's wait and see what Tim has to say about this ![]() -- Fernando Dias [Team Elevate] |
Mon, Mar 23 2009 3:06 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Fernando,
<< Currently EDB doesn't support ROW values, but it will in version 2.03. I don't know if Tim is going to change the INSERT statement syntax in the initial 2.03 build but if that is the case then we will be able to use that kind of set clause. >> With ROW value support, the UPDATE syntax will allow multiple column assignments in one shot: UPDATE MyTable SET (MyColumn1, MyColumn2, MyColumn3) = (SELECT MyColumn1, MyColumn2, MyColumn3 FROM MyOtherTable WHERE....) So, the need for joins in UPDATE statements will effectively go away. The INSERT statement will have some cool improvements like this, which is actually a table value constructor: INSERT INTO MyTable (MyColumn1, MyColumn2, MyColumn3) VALUES (100,'Test 100',10), (200,'Test 200',20), (300,'Test 300',30) etc. -- Tim Young Elevate Software www.elevatesoft.com |
Mon, Mar 23 2009 5:29 PM | Permanent Link |
"Malcolm" | Thanks guys.
That will do me for the moment. |
This web page was last updated on Wednesday, August 14, 2024 at 07:31 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |