you are right this
SELECT MAX([field]) FROM [table].... WITH LOCK ............
in the same command is wrong
Edit*** my contribution to this subject ends here
the only way to ensure uniqness with transactions is to use the build in autoinc,sequences or whatever is named from the engin... these algorithms operate outside of the transaction isolation to ensure the values produced are unique
the other way is to find your way to do it
one way provided already and in order to brake it and make it fault you must run amazon, ebay or something like that...
well if you are in this category you are in trouble with max+1 inside a transaction