As I build my SQL Server 2005 database model, I was criticized for using varchar columns to do a SQL joint instead of integer identity columns (that I should create for this purpose only).
I planned to do :
SELECT *
FROM TABLE1,TABLE2
WHERE TABLE1.string = TABLE2.string
(TABLE1.string and TABLE2.string are both indexed varchar(50) primary keys)
I was told I should more efficiently do :
SELECT *
FROM TABLE1,TABLE2
WHERE TABLE1.id_integer = TABLE2.id_integer
and add *.id_integer dedicated identity integer columns to improve joint efficiency (as int compare is supposed to be speedier than varchar compare).
Is there any truth in this ?
Thanks for your help.
I planned to do :
SELECT *
FROM TABLE1,TABLE2
WHERE TABLE1.string = TABLE2.string
(TABLE1.string and TABLE2.string are both indexed varchar(50) primary keys)
I was told I should more efficiently do :
SELECT *
FROM TABLE1,TABLE2
WHERE TABLE1.id_integer = TABLE2.id_integer
and add *.id_integer dedicated identity integer columns to improve joint efficiency (as int compare is supposed to be speedier than varchar compare).
Is there any truth in this ?
Thanks for your help.