Same Table Names Across 2 Databases Needing Simultaneous Con

Posted by v205 on 11-Oct-2019 13:47

Hello:

I am trying to figure out how to resolve this scenario, where we have several programs written against an older database called "WDS" that has a table called "Location" and now there is a new database called "Fascor" (this is a SQL Server Data Server) in the mix that we are also using, that also has a table called "Location". 

Our older code does not use database name qualifiers for tables. Considering that, how does one compile code like this? Imagine that before compiling the following code, you are connected to both WDS and Fascor databases, and both have the Location table:

// The FOR EACH is referencing a WDS Location table in this example

FOR EACH Location NO-LOCK:  <-- this line represents existing code

  FIND Fascor.Location WHERE ...<>...   <-- this line is new code

END. <-- this line represents existing code

Is there a way to resolve this using some start-up parameters etc.? 

Thanks in advance! 

v

All Replies

Posted by Peter Judge on 11-Oct-2019 14:22

I don't know if this is possible without changing all the code that needs to reference both tables.
 
You can either change the FOR EACH to add the WDS qualifier, or you can define a buffer with the same name, which should work.,
    DEFINE BUFFER Location FOR WDS.Location.
 
For example
// Command line is "prowin -ld s1 -db sports2000 -db sports2000"
define buffer Customer for sports2000.Customer.
 
for each Customer:
    find s1.Customer of Customer.
end.
 
For the code that only uses one table, just compile that code against one database.
 
 
 
 

This thread is closed