I am new to SQL server.
In MySQL when inserting a new record, im locking the table first,
use max(ID) + 1 to get a new ID and then release lock after
succesfully insert a record.
How you do this in MS SQL ?
I try to use subquery like
VB Code:
Insert Into StockGroup Values((SELECT max(id) FROM stockgroup) +1, "test")
Sub query not allowed.
Please help.
Also how get it work in Store Procudure.
Thanks.




Reply With Quote