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
SCOPE_IDENTITY()
Can't you just cast it before returning it from your query or stored proc (SPs alway return int anyway, but maybe you are using an output parameter)?
Like SELECT CAST(SCOPE_IDENTITY() AS INT) AS LAST_IDENTITY
SELECT CAST(SCOPE_IDENTITY() AS INT) AS LAST_IDENTITY
And why it does this? Probably to be more flexible and handle larger numbers.