xcaliber2222
Programmer
Hello, here is the join in my stored proc:
dbo.TEST AS o INNER JOIN
dbo.TEST2 AS i ON LTRIM(RTRIM(o.ICD9_PC1)) = LTRIM(RTRIM(REPLACE(i.ICD9, '.', ''))) OR
LTRIM(RTRIM(o.ICD9_PC2)) = LTRIM(RTRIM(REPLACE(i.ICD9, '.', ''))) OR
LTRIM(RTRIM(o.ICD9_PC3)) = LTRIM(RTRIM(REPLACE(i.ICD9, '.', '')))
Obviously this join will contribute to performance issues. My understanding is that if I can cast this to a numeric data type it should help. Can someone please show me an example of how I would do this in this case, with the replace statements?
Another issue is one table has 11,000 records, no big deal. But the other table has 707,233 records, so this I know is a problem as well.
I have clustered/non-clustered indexes on the joined fields accordingly.
I ran an execution plan and the clsutered index scans are returning about 50% each.
Any help would be greatly appreciated.
Thanks,
Alejandro
dbo.TEST AS o INNER JOIN
dbo.TEST2 AS i ON LTRIM(RTRIM(o.ICD9_PC1)) = LTRIM(RTRIM(REPLACE(i.ICD9, '.', ''))) OR
LTRIM(RTRIM(o.ICD9_PC2)) = LTRIM(RTRIM(REPLACE(i.ICD9, '.', ''))) OR
LTRIM(RTRIM(o.ICD9_PC3)) = LTRIM(RTRIM(REPLACE(i.ICD9, '.', '')))
Obviously this join will contribute to performance issues. My understanding is that if I can cast this to a numeric data type it should help. Can someone please show me an example of how I would do this in this case, with the replace statements?
Another issue is one table has 11,000 records, no big deal. But the other table has 707,233 records, so this I know is a problem as well.
I have clustered/non-clustered indexes on the joined fields accordingly.
I ran an execution plan and the clsutered index scans are returning about 50% each.
Any help would be greatly appreciated.
Thanks,
Alejandro