on 07-26-2011 10:27 AM
Hi
Consider 3 tables in a universe, A,B and C. Table A is joined to table B on ClaimNumber and ClaimantNumber and this works fine.
Now, I need to join table A to table C and thought the same joins would work.
However, on closer inspection, though tables A and C both have ClaimNumber and ClaimantNumber, for some reason ClaimantNumber on C is defined as 10 chars, where as elsewhere it is 3 chars. The joins don't work.
I need a way of joining the tables by the trimmed ClaimNumber and ClaimanatNumber, does anyone know how this can be done please?
Many thanks
Eddie
Why is it every time I post a question I then discover the answer myself! I should post more often! The simple solution is this:
Edit join in universe. The edit join window appears. At the bottom is the expression text. I changed it to read:
ltrim(rtrim(A.CLAIMANT_NO))=ltrim(rtrim(C.CLAIMANT_NO))
I then did this for the other join and it works great.
Eddie
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
SQL Server (2008) doesn't use function-based indexes to improve performance but what you can use is competed columns if you find that performance is not great. Have a look at this thread on msdn for reference if it comes to it:
Regards,
Mark
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.