0

I want to query from two tables present in two different database servers using ISQL. Query is

select * from server1.database1.table1
where column1 in (select column1 from server2.database1.table1)

How do I do this in ISQL?

jarlh
  • 42,561
  • 8
  • 45
  • 63
  • What database provider? Some database providers provide functionality to create linked server... – Maciej Los Sep 25 '20 at 06:20
  • Sybase ASE database – Gurunand A Sep 25 '20 at 06:37
  • So, use: [sp_remotesql](http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc36273.1572/html/sprocs/X21013.htm). More at: [SyBooks Onlie - Querying remote and heterogeneous databases](http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc00169.1520/html/iqperf/X100946.htm) – Maciej Los Sep 25 '20 at 06:40
  • We don't have the second server configured in sysservers table and can't add it there as this is Prod. Want to do it from ISQL – Gurunand A Sep 25 '20 at 06:57
  • this is not doable ... at least not with `isql`; `isql` is a (relatively) lightweight tool for passing commands to ASE and receiving/displaying results from ASE; `isql` would need several abilities that just aren't going to be added ... obtaining table/column metadata to determine if join is doable, a query compiler to assist in determining best query method (eg, which table is the outer table), a means of storing intermediate results (ie, memory and disk resources), etc ... and this is for your relatively simple `select`; what other T-SQL components would need to be supported? – markp-fuso Sep 25 '20 at 11:05
  • In that case I can execute the inner query in one ISQL session and store it in a bash variable and use it in the next query – Gurunand A Sep 25 '20 at 11:30

0 Answers0