Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 13 total
Thread An update question
Thu, Nov 5 2009 5:19 AMPermanent Link

Francisco Fernandez
Hi all.

Can I do an update between tables of different databases?

Something like this:

I have two databases: EMPRESA_01 and EMPRESA_99 and I want to update a field of the table
CLIENTES

UPDATE EMPRESA_99
SET EMPRESA_99.CLIENTES.NOMBRE=SELECT NOMBRE FROM EMPRESA_01.CLIENTES WHERE
EMPRESA_01.CLIENTES.NOMBRE=EMPRESA_99.CLIENTES.NOMBRE

(this of course does not work)

Thank you
Thu, Nov 5 2009 6:37 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Francisco


Are they using different sessions?

Roy Lambert [Team Elevate]
Thu, Nov 5 2009 6:44 AMPermanent Link

Francisco Fernandez
Roy.

No, I'm trying in edbmgr in the same session.
Thu, Nov 5 2009 7:27 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Francisco


I know you can update from one database to another because I do it. Staring at it for ages I finally realised your problem is

UPDATE EMPRESA_99

All you've given is the database name not the table name. Try

UPDATE EMPRESA_99.CLIENTES

Roy Lambert [Team Elevate]
Thu, Nov 5 2009 11:34 AMPermanent Link

Francisco Fernandez
Roy.

I put this instruction

UPDATE EMPRESA_99.CLIENTES
SET NOMBRE=SELECT NOMBRE FROM EMPRESA_01.CLIENTES.NOMBRE WHERE
CODIGO=EMPRESA_01.CLIENTES.CODIGO

but does not work

Do you have any example?

Thanks
Thu, Nov 5 2009 1:15 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Francisco


UPDATE Companies  SET Companies._Website = (SELECT _Website FROM LIVE.Companies WHERE _ID = 1000001) WHERE _ID = 1000001

Roy Lambert
Fri, Nov 6 2009 3:11 AMPermanent Link

Francisco Fernandez
Roy

   
UPDATE CLIENTES
SET CLIENTES.NOMBRE = (SELECT NOMBRE FROM EMPRESA_01.CLIENTES WHERE CODIGO = '1')

this works but I need to relate the two tables by the field code

something like ....

UPDATE CLIENTES
SET CLIENTES.NOMBRE = (SELECT NOMBRE FROM EMPRESA_01.CLIENTES WHERE CODIGO =
EMPRESA_01.CLIENTES.CODIGO)

Is this possible?

Thanks
Fri, Nov 6 2009 4:32 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Francisco


If you've tried it and it doesn't work what error do you get.

Roy Lambert [Team Elevate]
Sat, Nov 7 2009 4:53 AMPermanent Link

Francisco Fernandez
Roy

UPDATE EMPRESA_99.CLIENTES
SET NOMBRE = SELECT NOMBRE FROM EMPRESA_01.CLIENTES WHERE CODIGO =EMPRESA_01.CLIENTES.CODIGO

-->

ElevateDB Error #700 An error was found in the statement at line 2 and column 86 (Expected
end of expression but instead found .)

Thanks
Sat, Nov 7 2009 8:46 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Francisco


If the tables aren't to big post them to the binaries along with a description of what you're trying to do and I'll see if I can come up with a solution for you.

Roy
Page 1 of 2Next Page »
Jump to Page:  1 2
Image