lundi 28 novembre 2016

MySQL - Generate random unique code if collumn is NULL

I'm having a table col called unique_id which is set to NULL by default.

How can I "create a patch" and alter the table so when the unique_id is NULL to generate a random code (preferably as integer)

ALTER TABLE `projects`
CHANGE `unique_id` char('24') 
COLLATE 'latin1_swedish_ci' NULL 
DEFAULT 'none' 
AFTER `status`;




Aucun commentaire:

Enregistrer un commentaire