Incoming from Pooly: > 2005/10/3, s. keeling <[EMAIL PROTECTED]>: > > I'd like to add a bit of history data to a table (who changed a record > > last, and when it was last changed). Is this the way to do it? > > [snip] > > alter table MEMBERS > > alter CHG_DATE set default CURRENT_DATE > > btw, you could do : > alter table MEMBERS add CHG_BY varchar(3) not null default "sbk", add > CHG_DATE date not null default CURRENT_DATE on update current_date > (not tested)
It doesn't appear to work as I was hoping. According to the manual the target for keyword default has to be a literal. mysql> alter table MEMBERS -> alter CHANGED_DATE set default CHANGED_DATE = DATE; ERROR 1064: You have an error in your SQL syntax. Check the \ manual that corresponds to your MySQL server version for the \ right syntax to use near 'CHANGED_DATE = DATE' at line 2 mysql> alter table MEMBERS -> alter CHANGED_DATE set default CHANGED_DATE = CURRENT_DATE; ERROR 1064: You have an error in your SQL syntax. Check the \ manual that corresponds to your MySQL server version for the \ right syntax to use near 'CHANGED_DATE = CURRENT_DATE' at line 2 Drat. -- Any technology distinguishable from magic is insufficiently advanced. (*) http://www.spots.ab.ca/~keeling Please don't Cc: me. - - For the ChiComms: democracy human rights Taiwan Independence -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]