[dba-SQLServer] join pulls no records

Jim Lawrence jlawrenc1 at shaw.ca
Fri Dec 1 14:23:06 CST 2006

Hi John:

Have you checked to see if some of the fields, in the index, that you are
depending have 'nulls'. In some cases a single null will negate the entire
select. Oracle has a NVL() function that resolve this but I am sure MS SQL
does also. Try reversing the joins (outer - inner) and see if there are any


-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of JWColby
Sent: Friday, December 01, 2006 12:00 PM
To: dba-sqlserver at databaseadvisors.com
Subject: [dba-SQLServer] join pulls no records

I have two tables.  Each has an nvarchar 50 field which contains a string
consisting of the first 5 characters of about 5 different fields, which is
called in the client's industry a "match code" and is used to find the same
name / address record in a different table.  I have made the field the PK,
so there is an index and it is unique.  A join of the two tables pulls no
records.  I can manually look in the two tables and see visually identical
data, i.e. it looks like the match code matches but an inner join does not
pull records.
Any clue why not?
John W. Colby
Colby Consulting
dba-SQLServer mailing list
dba-SQLServer at databaseadvisors.com

More information about the dba-SQLServer mailing list