how to increment integer Columns value by 1 in SQL

前端 未结 6 1027
青春惊慌失措
青春惊慌失措 2020-12-05 01:50

My questions is

how to increment a column\'s value by 1.

For example, suppose a column ID has values 1,2,3,4, ..

6条回答
  •  醉话见心
    2020-12-05 02:01

    If you want to have an unique number for each row automatically generated, this is IDENTITY as per Neil's answer.

    If each time you update the table you want to increase the values (ie they are not keys):

    Update MyTable
    Set IDColumn = IDColumn + 1
    Where 
    

提交回复
热议问题