MattSmithProg
Programmer
Hi,
I am inserting a row of data in to a table and as the primary key determing the maximum field for that value and adding one. I would like to know how I can return this as soon as I have done it. I would normally just use a simple select query to return the max record but as there are multiple users this may not return the correct value. My insert query is this:
INSERT INTO PTAPP_TTN_Main SELECT (COALESCE(MAX(Item_No), 0)) + 1, '16/04/2002', Null, 'set gtg stgtg ', 2, -1, '', 7, 5, 'a f gagaeeqa tet qety qty y', 'UBD2O', '' FROM PTAPP_TTN_Main
Where Item_No is the Primary Key and the number I am wanting to return.
Any ideas would be greatly appreciated. Matt Smith
No two nulls are the same
I am inserting a row of data in to a table and as the primary key determing the maximum field for that value and adding one. I would like to know how I can return this as soon as I have done it. I would normally just use a simple select query to return the max record but as there are multiple users this may not return the correct value. My insert query is this:
INSERT INTO PTAPP_TTN_Main SELECT (COALESCE(MAX(Item_No), 0)) + 1, '16/04/2002', Null, 'set gtg stgtg ', 2, -1, '', 7, 5, 'a f gagaeeqa tet qety qty y', 'UBD2O', '' FROM PTAPP_TTN_Main
Where Item_No is the Primary Key and the number I am wanting to return.
Any ideas would be greatly appreciated. Matt Smith
No two nulls are the same