To avoid datatype mismatch problems:
When you create tables, use the same datatypes for columns that will be joined.
If columns of two frequently joined tables have different datatypes, consider using alter table...modify to change the datatype of one of the columns.
Use the column’s datatype whenever declaring variables or stored procedure parameters that will be used as search arguments.
Consider user-defined datatype definitions. Once you have created definitions with sp_addtype, you can use them in commands such create table, alter table, and create procedure, and for datatype declarations.
For some queries where datatype mismatches cause performance problems, you may be able to use the convert function so that indexes are considered on the other table in the join. The next section describes this work around.