I am using Simple.Data as my Micro-ORM for my ASP.NET / MySQL website. I already know how to insert data when the primary key is auto incremental Int, but How can I insert data when I need to generate an idea using the uuid_short() function over a Bigint column?
Asked
Active
Viewed 565 times
1 Answers
1
You could use a trigger to set the column value, as in this answer: Can I use a function for a default value in MySql?
Or you can generate a value in your application code and insert it normally.

Community
- 1
- 1

Mark Rendle
- 9,274
- 1
- 32
- 58
-
You mean run a select command with uui_short function against the DB and then make the insert? – Liron Harel Oct 18 '12 at 10:28
-
Is there an option to do it without using triggers? – Liron Harel Oct 18 '12 at 13:22
-
For example, make a select statement with uuid_short function, get the number and then insert. Will it work ok? – Liron Harel Oct 18 '12 at 17:52
-
Do you specifically need UUID_SHORT? For a bigint column, DateTime.Now.Ticks would probably be unique. – Mark Rendle Oct 21 '12 at 16:18