Use of ROWID to update a record?
Posted in 1997
Topics: General Discussion
I'd like to update the primary key in a table. The key is assigned by the user (not many records in this table). One option I've considered is using ROWID, but apparently this attribute is not passed into a RECORD LIKE variable. My other thought is to pass the primary key to a variable before any changes are made, but haven't had luck executing. I'd rather not implement a SERIAL attribute for this small table. Employee table: namecode (primary key, unique) TEQ NHF JAH Code initiated by Edit option on a menu: COMMAND "Edit" "Update this record." MESSAGE "You are now in edit mode." ATTRIBUTE (underline) INPUT BY NAME pr_emp.* WITHOUT DEFAULTS LET pr_emp.namecode = key UPDATE tbl9employee SET tbl9employee.* = pr_emp.* WHERE namecode = key --I initially used WHERE namecode = pr_emp.namecode --Then I tried WHERE ROWID = pr_emp.ROWID MESSAGE "Record updated." NEXT OPTION "Next" (This is my first attempt at updating a record in Informix using a menu/form combination. I do plan to dish some of this code out to a function. Any additional advise definitely welcome.) Tks, Nelson Nelson Fredsell Cornerstone Capital Atlanta, GA nfredsel@cornercap.com Nelson Fredsell Cornerstone Capital Atlanta, GA nfredsel@cornercap.com