Hi, Please help, I have 2 Databases, called SISPETRO and SB-PEDIDOS, runnig on the same server, and I have on Sispetro DB, tables NOTAS and ITENSNOTAS, I can join both, without problems, but I need to get a value from table FRETES on SB-PEDIDOS DB. This is more or less the code Im trying.

select notas.codClient, notas.quantity, itens.product, fretes.valueFrete from NOTAS notas left join ITENSNOTAS Itens on (notas.seq = itens.seq) left join FRETE Frete on (notas.CodTransp = Frete.CodTransp) where ....

Im doing this inside a Delphi Aplication, I didnt try it into Interactive SQL. There is another issue, I think, the database name has a less signal(-) into its name, and it may be consider a forbiden character.

asked 21 Jun '12, 14:58

RDPSispetro's gravatar image

RDPSispetro
895610
accept rate: 0%


Try these commands on the SISPETRO database; they define a "remote server" called SB-PEDIDOS which points to the database SB-PEDIDOS, and a proxy table for FRETES. The schema for proxy_FRETES exists on the SISPETRO database, but the data only exists on SB-PEDIDOS.

CREATE SERVER "SB-PEDIDOS" CLASS 'SAODBC' 
   USING 'DRIVER=SQL Anywhere 12;DBN=SB-PEDIDOS';

CREATE EXISTING TABLE proxy_FRETES AT 'SB-PEDIDOS...FRETES';

SELECT * FROM proxy_FRETES ORDER BY proxy_FRETES.pkey;

permanent link

answered 21 Jun '12, 17:23

Breck%20Carter's gravatar image

Breck Carter
27.0k444614889
accept rate: 21%

edited 21 Jun '12, 17:26

Dear Mr Breck and Mr Glen, Thanks for your answer, I decided to let lazy behind. I paid more attention to documentation, as Glen told me, and found the entire process, create an external server, then external tables, everything throug SybaseCentral. And, my surprise, was exactly like you show above Mr Breck. Im learnig a lot with this forum, Thanks a lot.

(21 Jun '12, 17:32) RDPSispetro
Replies hidden
1

We all learn a lot here ;-)

(22 Jun '12, 03:08) Martin

The documentation describes how to set up a remote server, and how to create a proxy table to enable you to refer to the FRETE table from a local query when connected to the SISPETRO database.

What precisely is the issue you're having with the database name?

permanent link

answered 21 Jun '12, 15:50

Glenn%20Paulley's gravatar image

Glenn Paulley
10.7k571104
accept rate: 43%

Yes, I saw this before, but the documentation I found are too simple, Im having trouble to name the tables correctly. This method, create proxy_table, works at running time or creates a table phisicaly into my database ? I can create this proxy table and then select data from it ? Joinning to other tables ? How to clear or destroy this table after.

The issue I told is related to minus signal into databasename, SB-Pedidos, I mentioned because I got an error on my query into delphi code, but, leave it.

(21 Jun '12, 16:27) RDPSispetro
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×21
×21

question asked: 21 Jun '12, 14:58

question was seen: 10,700 times

last updated: 22 Jun '12, 04:30