Automatic computation of field from values of other fields during INSERT
This should be basic for SQL experts:
Every time I create a record (INSERT) in my table, I want field 1 to be unique and it will be determined values in three other fields, two which are variable length strings and one which is date type. It works by concatenating the strings (the date is cast as a string, either as a Unix timestamp integer or as readable expression of the date...it's all arbitrary) and then computing the CRC32 value of the concatentation.
field1 = CRC32(concatenation of field2, field3, timestamp? form of field4)
field1 becomes my "document ID" column
But I don't want to write the SQL in the phpMyAdmin interface I am presently using to work on the records every time I do an INSERT/UPDATE. I want it to be automatic. I want the database/table/server to execute the procedure on that table when an INSERT/UPDATE is done, and the field1 (column1) should not even be presented by phpMyAdmin as modifiable to the user when the INSERT/UPDATE interface is presented, since it is computed.
How is that set up?
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread