Hi, I have a table that I need to migrate some data into:
CREATE TABLE `employee` ( `employeeid` bigint(20) NOT NULL auto_increment, .. `reference` varchar(20) default NULL, `fkcompanyid` bigint(20) default NULL, PRIMARY KEY (`employeeid`), KEY `FK4722E6AE82D7E095` (`fkcompanyid`), CONSTRAINT `FK4722E6AE82D7E095` FOREIGN KEY (`fkcompanyid`) REFERENCES `company` (`companyid`), ... ) ENGINE=InnoDB AUTO_INCREMENT=1000000000001585 DEFAULT CHARSET=latin1 | My question is I want to generate a reference business key (a number) as the migrated data is blank. something like update employee set reference = ROWNUM where fkcompanyid = X I think in Oracle ROWNUM would help me do this. I.e. generate a reference based on the position in the result set. any Ideas ? -- Tom Goring