![]() | Products |
| Home » Technical Support » ElevateDB Technical Support » Incident Reports » Incident Reports Addressed for Version 2.03 » View Incident Report |
| Reported By: James Relyea Reported On: 11/17/2009 For: Version 2.03 Build 6 |
SCRIPT
BEGIN
declare cur cursor without return for selCur;
declare sql statement;
declare sqlUpdate statement;
declare idGuid guid ;
declare intOldId int;
--update the corp ids
prepare selCur from 'SELECT tCorps.idCorpID, tCorps.zzCorpId
FROM tCorps INNER JOIN
tCorps_tContacts_XRef ON tCorps.zzCorpId = tCorps_tContacts_XRef.zzCorpId';
start transaction on tables tCorps_tContacts_XRef;
begin
open cur;
fetch first from cur (idCorpID,zzCorpId) into idGuid,intOldId;
while not eof(cur) do
prepare sqlUpdate from 'update tCorps_tContacts_XRef set idCorpId=? where zzCorpId=?';
execute sqlUpdate using idGuid,intOldId;
fetch next from cur (idCorpID,zzCorpId) into idGuid,intOldId;
end while;
--corp ids updated
--update the dept ids
close cur;
unprepare selCur;
unprepare sqlUpdate;
prepare selCur from 'SELECT tDepts.idDeptId, tDepts.zzCorpDeptId
FROM tCorps_tContacts_XRef INNER JOIN
tDepts ON tCorps_tContacts_XRef.zzDeptId = tDepts.zzCorpDeptId';
open cur;
fetch first from cur (idDeptId,zzCorpDeptId) into idGuid,intOldId;
while not eof(cur) do
prepare sqlUpdate from 'update tCorps_tContacts_XRef set idDeptId=? where zzDeptId=?';
execute sqlUpdate using idGuid,intOldId;
fetch next from cur (idDeptId,zzCorpDeptId) into idGuid,intOldId;
end while;
--deptd ids updated
--update the contact ids
close cur;
unprepare selCur;
unprepare sqlUpdate;
prepare selCur from 'SELECT tContacts.idContactId, tContacts.zzContactId
FROM tCorps_tContacts_XRef INNER JOIN
tContacts ON tCorps_tContacts_XRef.zzContactId = tContacts.zzContactId';
open cur;
fetch first from cur (idContactId,zzContactId) into idGuid,intOldId;
while not eof(cur) do
prepare sqlUpdate from 'update tCorps_tContacts_XRef set idContactId=? where zzContactId=?';
execute sqlUpdate using idGuid,intOldId;
fetch next from cur (idContactId,zzContactId) into idGuid,intOldId;
end while;
--contact ids updated
commit;
exception
rollback;
raise;
end;
ENDThis web page was last updated on Wednesday, April 8, 2026 at 04:38 AM | Privacy Policy © 2026 Elevate Software, Inc. All Rights Reserved Questions or comments ? |

