See
http://www.craigberntson.com/Articles/kb006.htm>I am trying to increment the id column of Table1 every time an INSERT occurs. I have put this code in the stored procedures, and call it from the INSERT trigger.
>
>I get the message "cursor cannot be updated". Does anyone know how to do this right? Maybe someone has a link to code that does this sort of thing.
>
>FUNCTION AutoIncrement()
>LOCAL xx[1]
>SELECT MAX(id) FROM table1 INTO ARRAY xx
>replace id WITH xx[1]+1
>RETURN .t.
>
>Regards,
>
>Costas