Generating unique ID's automatically?
Posted in 1997
Is there any way, other than using the SERIAL type, to have unique IDs generated automatically? Say, for example, I create a procedure like: create nextID example() returning int; define retUserID int; select max( userID ) into retUserID from User; return retUserID; end procedure; ... can I somehow attach this procedure to the UserID field of the User table, such that when someone enters a new row of values for the User table and leaves out the ID, it'll be automatically generated? If not, is there another way? -- Cos (Ofer Inbar) -- cos@leftbank.com cos@cs.brandeis.edu -- The Left Bank Operation -- lbo@leftbank.com http://www.leftbank.com/ "Good literature is about Love and War." "Junk fiction is about Sex and Violence."