3

I have a pre-existing table that has a column to that can hold a UUID.

I'd like to be able to define a default such that new rows coming in (from legacy systems) will still get a UUID defined, via the UUID() function -- is it possible to configure the default of a column to be a value returned by UUID (in a similar manner to how you can for the UNIX_TIMESTAMP() in phpMyAdmin)

RolandoMySQLDBA
  • 182,700
  • 33
  • 317
  • 520
Rowland Shaw
  • 557
  • 4
  • 11

1 Answers1

7

Using a trigger

You can't use functions as defaults in MySQL, except for CURRENT_TIMESTAMP for TIMESTAMP columns

gbn
  • 69,809
  • 8
  • 163
  • 243