General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Same named databases
All,
I have a situation with two same named databases
\data\samename.dbc
and
\data\archive\samename.dbc
An archiving routine moves deleted records from \data\sametable.dbf to \data\archive\sametable.dbf
This routine selects the deleted records from \data\sametable.dbc into a cursor, then scans the cursor, scattering to memvar, uses the \data\archive\sametable.dbf,
appends a blank and gathers the menvars.
Adding the blank fires a trigger for a stored procedure newid() from a table (also same named, of course) that holds the next pk for every table.
The problem appears to be that the stored procedure newid() in the \data\samename.dbc fires, and draws the new id.
What SHOULD happen is for the stored procedure newid() in \data\archive\samename.dbc fires to get a new id from \data\archive\keylist.dbc
There is no SET DATABASE TO samename anywhere. The stored procedure will fire in the SET DATABASE ??????.dbc
Of course, every so often a duplicate pk from \data\keylist hits in the \data\archive\sametable.dbc and blows out several other things.
There is a lot of code to change, and the error handling consists of a cascade of ON ERROR thiserror = .T. style code which is very convoluted.
Is there any way to handle a 'SET DATABASE TO samename' with something like an alias to be sure the correct stored procdure is being called?
TIA for ideas.
Al Allison
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only