Gossamer Forum
Home : General : Databases and SQL :

Convert ID

Quote Reply
Convert ID
Hi all,

I have the following problem: I need to import an SQL table with 3000 records but all without ID, and the target table requires an ID. So the question is: How to generate an unique ID for earch records (starting with max(targettable.id)) ?

Any help would be great!
Quote Reply
Re: [cK] Convert ID In reply to
Something like this?
CREATE TABLE `name_of_table` (
`id` mediumint(8) unsigned NOT NULL auto_increment,
} TYPE=MyISAM AUTO_INCREMENT=max(targettable.id) ;