Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8637999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:36:58+00:00 2026-06-12T10:36:58+00:00

I have a problem that’s really confounding me. I half-expect one of you to

  • 0

I have a problem that’s really confounding me. I half-expect one of you to point out some really dumb mistake that I’m overlooking but I’m really just not seeing it.

I have a table that our production processes have been feeding for something like a year and we just got some crazy tables from our client against which we are trying to match data. In the following queries, tableA is my table and tableB is the table we’ve just imported.

The basic problem is that

select *
from tableA
where convert(nvarchar(30),accountNum) not in (
        select CisAC
        from tableB
    )

isn’t returning any records when I believe it should be. I think that it should find any records in tableA where the accountNum matches the CisAC field in tableB. Right? CisAC is an nvarchar(30) and our accountNum field is a bigint.

To point out why I think an empty return set is wrong:

select * from tableA where convert(nvarchar(30),accountNum) = '336906210032'

returns one record but

select * from tableB where CisAC = '336906210032'

does not.

So, what gives? (And thanks for your time!)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T10:36:59+00:00Added an answer on June 12, 2026 at 10:36 am

    This is probably the classic not in mistake. If table B contains any null value,

    where convert(nvarchar(30),accountNum) not in (
            select CisAC
            from tableB
        )
    

    will never succeed. You can write it out like:

    where convert(nvarchar(30),accountNum) <> null and convert(nvarchar(30),accountNum) <> ...
    

    Since any comparison to null evaluates to unknown, this condition is never true.

    Replacing the query with a join like the podiluska’s answer suggests should do the trick.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem that I'm working on for quite some time now. I
I have a problem that is getting embarrassingly out of hand. I'm working with
I have a problem that I can't figure out myself. I've tried using LEFT
I have the problem that a given object could be one of several different
I have a problem that when a user times out on my site they
I have a problem that I can't figure out. I'm building a small framework
I have problem that on Galaxy S3 some images are replaced by black square.
I have a problem that annoys me pretty much. I'm grabbing some content from
I have a problem that is hampering my analyses. For some weird reason, whenever
I have problem that i just cant figure out right now. I am trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.