I am running a very simple insert query that should return the identity key from a MSSql server. When I run the query below, and print the results I get a incrementing values (1316134921, 1316134922, 1316134923 for example). However, that is not the value I expected. It should have been "10000000000010, 10000000000011, 10000000000012...etc"
When I run the query directly on the SQL server, I get the correct value.
The docs say that system.db.runPrepUpdate returns an integer, and 10000000000010 is too big for an integer. I suspect that 1316134921 is the value you get taking integer overflow into account, but I don't have time right now to verify.
You may already be thinking of this, but a word of caution with switching from bigint to int. If that column is an auto incrementing value, you are already over half way to the max value that a signed int column can hold. No idea how much time that gives you with your process, but I just wanted to make sure you're not missing that potential future pain point.