Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2013
    Posts
    1

    Unhappy Unanswered: Why does 2 appear instead of NULL?

    Hello,

    I have a question, why does the @MName variable return 2 instead of NULL (which is the value in the actual database)?

    CODE: [SQL] sql123 - Pastebin.com

    Maxwell D.

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    What is returned by:
    Code:
    DECLARE @Email VARCHAR(200) = 'sometest@email.com'
    
    SELECT
       MEM.First_Name,
    ,  MEM.Last_Name,
    ,  MEM.Middle_Name,
    ,  PHNE.MPhone,
    ,  PHNE.WPhone
       FROM Members             AS MEM
       INNER JOIN Registrations AS REG
          ON MEM.Reg_Key = REG.Reg_Key 
       INNER JOIN Address       AS ADDRH
          ON ADDRH.Mem_Key = MEM.Mem_Key 
          AND ADDRH.Addr_Type LIKE 'HOME'
       INNER JOIN Address       AS ADDRW
          ON ADDRW.Mem_Key = MEM.Mem_Key 
          AND ADDRW.Addr_Type LIKE 'WORK'
       INNER JOIN Phone         AS PHNE
          ON PHNE.Mem_Key = MEM.Mem_Key
       WHERE REG.Email LIKE @Email;
    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •