question

sqlLearner 1 avatar image
sqlLearner 1 asked

Lookup Table not working

Let me start by naming my two tables: My first table is Table2 second is LookupTbl2 I have a weird situation that I need some help on. So Table2 joins to LookupTb12 to map certain terms. Now about 90% of the values map correctly. They other 10% show NULL after I join them. The terms match exactly in both tables (spaces and all): How can this be I am assuming they have different BinaryValues somehow Any ideas how to resolve this?
tsqllookupsbinary
3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

SirSQL avatar image SirSQL commented ·
Would this be a left or right join? Do you have the same collation setting on both tables? Can you post the ddl and a couple of data examples?
0 Likes 0 ·
sqlLearner 1 avatar image sqlLearner 1 commented ·
Its a inner join in a subquery. Forget about the lookup table for a second I'll even make this simpler. If I just run a simple select statement with a where clause specifying the term it returns zero rows. I copy the term straight from the results grid of Management Studio. Select * from Tabl2 Where term = 'Hello' (THIS Retruns nothing and I copy and paste the term)
0 Likes 0 ·
JohnM avatar image JohnM commented ·
As mentioned by @SirSQL, would it be possible to post the DDL of the table and some possible data examples? Without this information troubleshooting your issue will be pretty tough I think.
0 Likes 0 ·

1 Answer

·
sqlLearner 1 avatar image
sqlLearner 1 answered
I seem to have found the issue...I was importing a tab delimited file and the terms that were troublesome were spread across multiple lines of the file. Once I corrected this in the import file Everything worked correctly. Although it was a pain going through that whole file.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.