Why does select SCOPE_IDENTITY() return a decimal instead of an integer?

后端 未结 4 1275
野性不改
野性不改 2020-11-27 05:10

So I have a table with an identity column as the primary key, so it is an integer. So, why does SCOPE_IDENTITY() always return a decimal value instead of an int

4条回答
  •  独厮守ぢ
    2020-11-27 06:15

    try using this and you'll get an integer back:

    ExecuteScalar('insert...; select CONVERT(int,scope_identity())');
    

提交回复
热议问题