hi steven
it was actually $$ not ##.
this works for me it will also get the last insert key change to suit db ie @@identity sqlserver
<insert id="test" parameterClass="string"> $value$ <selectKey resultClass="int"> select LAST_INSERT_ID() </selectKey> </insert>
You might want to be careful about using the LAST_INSERT_ID(). That function returns the last auto_incremented value maintained by the server. In a multiuser environment their is the possibility of a race condition. The function is also not portable.
As an alternative I create a Sequence table containing "name, id" fields. When an insert to a table is performed, first query the sequence table to get the last id, use it for the value for the primary key (don't use an auto-increment value), then increment the value after the insert succeeds.
John Fereira
[EMAIL PROTECTED]
Ithaca, NY