• To expand a little on Luis's answer, SQL Server has a strict data type-precedence which says that when two types meet, the type with lower precedence will be converted to the type with higher precedence - all provided that there is an implicit conversion at all. smallint has lower precedence than int.

    What puzzled me is that I seemed to recall that the data type of a literal < 256 is tinyint, but I was wrong. The way to find out the data type of a literal is this:

    DECLARE @s-2 sql_variant = 99

    SELECT sql_variant_property (@s, 'BaseType')

    And it gives that the type of 99 really is int.

    [font="Times New Roman"]Erland Sommarskog, SQL Server MVP, www.sommarskog.se[/font]