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
185k34 gold badges327 silver badges541 bronze badges
asked Nov 15, 2011 at 12:56

1 Answer 1

7

Using a trigger

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

answered Nov 15, 2011 at 13:27

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.