How to add plus one (+1) to a SQL Server column in a SQL Query

后端 未结 2 1305
孤街浪徒
孤街浪徒 2021-02-01 13:10

The simple question is, how do you increment a field value in a MS Query by 1 ? I am trying to add 1 (+1) to an int column in my SQL Server database using a paramet

相关标签:
2条回答
  • 2021-02-01 13:19
    "UPDATE TableName SET TableField = TableField + 1 WHERE SomeFilterField = @ParameterID"
    
    0 讨论(0)
  • 2021-02-01 13:27

    You need both a value and a field to assign it to. The value is TableField + 1, so the assignment is:

    SET TableField = TableField + 1
    
    0 讨论(0)
提交回复
热议问题