Applies to: MS SQL as reported; the thread names no Clarion or server version.
Problem
A process procedure creates records in a database in use. Some of those records, with some data changed, must also be added to a table in another database on another server. The two servers are joined by a VPN. The poster asked for the best approach and described himself as no SQL expert.
Solution
Five answers were offered, in this order:
- Import the other table into the dictionary with its own connection variable, so each server and database has a separate one. Then, in the process procedure, add the records with Clarion statements or with PROP:SQL statements. One poster found PROP:SQL more reliable than Clarion statements in a process, especially over a VPN where the response is slower than a local one.
- Code it with a queue: declare a queue with the same structure as the table, loop the first table into the queue, close the connection, change the connection variable, open the second table, then loop the queue and ADD each record (assigning the queue to the second table's record first).
- Use a stored procedure on the first database that does the insert, including the insert into the second database, when there is logic about which records to copy.
- Use a trigger on the first table when every record inserted there is always inserted in the other one.
- A commercial tool, DMC, was suggested as the easiest way, with its transfer and column mapping pages.
Caveats
- The poster asked whether one table with a variable connection could be opened on the first database, then the connection changed, then used on the second. The answer was "No, you need two connection strings".
- The poster had not considered a trigger because the copied data is not an exact copy and the databases are not on the same server. The trigger poster replied that permissions are the only issue across servers, a little painful but fine once set up.
- The poster said he would look into the trigger; no outcome was reported.
Today (2026)
Likely unchanged in principle: two connection variables, PROP:SQL, a stored procedure or a trigger are all still available. Not re-tested; the permissions between servers depend on the server setup.
Sources: Antonio D. (Jun 2013, the question), Geoff B., JP G., Dennis E. (Jun and Jul 2013) in softvelocity.clarion.databasedrivers.