case tcTriggerType = "I" select top 1 rtp_id from rtp_projects order by keyid desc into array a1 insert into changelog (editdate, editby, rtpid, newvalue) values (datetime(), employee, a1, "Project created")returns the RTP_ID from the previous last record not the new one. So I'm guessing the new record hasn't been created yet. ??