How to use --> EXIST/Not Exist

  • Question....

    I got 2 DB (identical) on the same server, f i run the same quey on the first db the result seem to be true, but in the other one it looks to be false!!!

    Why?

    This is the query!!

     SELECT DISTINCT

      TMP1.MATNR , 1

     FROM #TMP_PROD TMP1

     WHERE NOT EXISTS (SELECT * FROM  #TMP_COMP TMP2 ,

            #TMP_PROD TMP3

             WHERE TMP2.AUFNR = TMP1.AUFNR and

            TMP3.MATNR = TMP2.COMPNR)

    In my opinion the problem is in the NOT EXIXT Clause!!!

    Is there any setting in SQLServer or some other thing that can make it!!

    Thanks Alessandro

  • Here is one thing to consider:  check the ANSI_NULLS settings for the database.

    This setting is described in Database Options in books online.

    Russel Loski, MCSD

    Russel Loski, MCSE Business Intelligence, Data Platform

  • Ithank you...but i already do this!!

    In the two DB the settings are the same!!!

    Is there something else to control??

    thanks alessandro

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply