I must do an insert into statement on a identity indexed table:
MSG_ID --> the identity (autoincrement)
MSG_PARENT --> the field i must fill
I must fill MSG_PARENT with a MSG_ID value, after the insert..
insert into MESSAGES (MSG_DESCRI,MSG_PARENT)
values ('hello world',identity value after insert)..
what's the best way to do this??
I must do this cause the first node of my tree must have MSG_PARENT = MSD_ID.. the root node..
in sql server i use a stored proc, i exec the insert and i use the @@identity sysvar... but my mysql version don't supports stored procedures..
can anyone help me??
null is not the best for my root node..
but i can use the function that you tell me in last message..
so, under the same transaction that funcion don't return any value..
right? i must wait the commit of my transaction?
But i must do this in one transaction...