The details of how each data type is guessed are complex and incompletely documented. As a starting point, SQL Server infers a basic type from the textual representation of the value, then uses the smallest compatible subtype.
For a string of numbers without quotation marks or a decimal point, SQL Server chooses from
integer. For such numbers beyond the range of an
integer, SQL Server uses
numericwith the smallest possible precision. For example, the number 2,147,483,648 is typed as
biginttype isn’t used for server-side parameterization. This paragraph explains the data types selected in the prior examples.
Read the whole thing to see what’s in and what’s out, as well as what this all means.