Datatypes in join columns

The columns being joined must have the same or compatible datatypes. Use the convert function when comparing columns whose datatypes cannot be implicitly converted. Columns being joined need not have the same name, although they often do.

If the datatypes used in the join are compatible, Adaptive Server automatically converts them. For example, Adaptive Server converts among any of the numeric type columns—bigint, int, smallint, tinyint, unsigned bigint, unsigned int, unsigned smallint, decimal, or float, and among any of the character type and date columns—char, varchar, unichar, univarchar, nchar, nvarchar, datetime, date, and time. For details on datatype conversion, see Chapter 16, “Using Transact-SQL Functions in Queries,” and Chapter 1, “System and User-Defined Datatypes,” in the Reference Manual: Building Blocks.