Progress_Learner
Member
Hello All,
I have two databases and I want to compare table by table and records by records on the basis of unique index/key only and later I have to record the changes found.
I know it can be done by using some dynamic query only (have very less idea of that), I tried to create dynamic query for this but things are not going in the right direction. Below is the code that I tried:
Kind thanks and regards for any help.
Learner
I have two databases and I want to compare table by table and records by records on the basis of unique index/key only and later I have to record the changes found.
I know it can be done by using some dynamic query only (have very less idea of that), I tried to create dynamic query for this but things are not going in the right direction. Below is the code that I tried:
Code:
define var h1 as handle no-undo.
define var h2 as handle no-undo.
define var h3 as handle no-undo.
define var fh as handle no-undo.
define var bh as handle no-undo.
define var ch-tname as char no-undo.
define var ch-uidx-field as char no-undo.
for each db1._file where _tbl-type = "T" no-lock,
first _index of _file where _index.unique = true no-lock,
first _index.field of _index no-lock,
first _field of _index-field no-lock:
/* This will give first unique index field name */
ch-uidx-field = _field._field-name.
ch-tname = _file-name.
create buffer bh for table ch-tname. /* Is it fine to put create dq here */
create query h1.
h1:set-buffers(bh).
h1:QUERY-PREPARE("FOR EACH" + ch-name + "NO-LOCK")
create query h2.
h2:set-buffer(db2.bh). /* like this? */
h2:query-prepare("find first" + ch-name + use-index + ch-uidx-field). /* seems wrorng */
end. /* end of first for each loop */
Kind thanks and regards for any help.
Learner