this will probably work better come to think of it: create trigger foobar before insert on t1 for each row begin set NEW.hash = md5(now()) end;
On Wed, Aug 18, 2010 at 1:22 PM, Nick Jenkin <[email protected]> wrote: > The best way would be to modify your SQL insert query to do this, > however you can use triggers: > > something like this might work: > > create trigger foobar after insert on t1 > for each row begin > update t1 set t1.Hash = md5(now()) where t1.id = NEW.id > end; > > > On Wed, Aug 18, 2010 at 10:22 AM, Brendan Brink > <[email protected]> wrote: >> hi there, >> >> wanting to have a text field in a table have a default value of >> md5(time()) - is this possible in creating the table structure in >> MYSQL5 >> >> So that when a new row inserted into a table, a hash field is >> automatically created? >> >> Cheers >> brendan. >> >> -- >> NZ PHP Users Group: http://groups.google.com/group/nzphpug >> To post, send email to [email protected] >> To unsubscribe, send email to >> [email protected] > -- NZ PHP Users Group: http://groups.google.com/group/nzphpug To post, send email to [email protected] To unsubscribe, send email to [email protected]
