Read and Increment int value in SQL Server

前端 未结 2 554
孤独总比滥情好
孤独总比滥情好 2021-01-25 20:39

I need to read and increment a value atomically in SQL Server 2008, using c#.

For example, I have to insert items of a \"lot\", for this i need the number of the last lo

2条回答
  •  自闭症患者
    2021-01-25 20:41

    The easiest way would be to just alter the table so that the lot number is an identity field and will auto-increment itself. Then you don't have to worry about incrementing in code.

提交回复
热议问题