ODBC support JOINS?

  • Hi,

      I have a application on VB5 that uses the ODBC connector on a Windows 2000 OS. The application uses an OUTER JOIN statement. The result returned contains duplicate records which is not correct.

      I remembered that I have read somewhere that ODBC does not support JOIN statements but can no longer find the article on it. Appreciate it if someone here can enlighten me on this issue.

      Thanks.

    Chee Hwee.

  • Can you post the query?

    As far as i know you can't join the DBCC command as its nothing but system sp & you con't join sp's.

     

     

     

    ------------
    Prakash Sawant

    http://psawant.blogspot.com

  • Prakash, I think you misread the question.  It's about ODBC, not DBCC...

    Anyhow, you certainly can pass just about any SQL command through ODBC - including joins, etc.. For example, the OSQL & ISQLW utilities use ODBC to connect to your SQL Server.

    Could you post some of your data and your query?  I suspect you are getting duplicates based on your join conditions rather than your data access layer.

  •  

    Oho you got me man…

     

    I am sorry to miss read that, actually for some time I was busy with DBCC commands, so I started reading every thing as DBCC.

     

     Any ways thanks for pointing this to me.

    ------------
    Prakash Sawant

    http://psawant.blogspot.com

  • Yes, ODBC does support JOIN statements, and VB5 can handle them. This is not the issue.

    Most likely, the issue is a misunderstanding of how the OUTER JOIN would work. In certain cases, the OUTER JOINs can lead to duplicate records, depending on the data (in the duplicate records, the values from one of the tables should show multiple NULL values). Showing your schema and query would be a good step to understanding the issue.

    Thanks,

    Brendt

  • I see... But it is strange that when i used the SQL Query analyser, I got results with no duplicates. But if I execute the query through ODBC, I received duplicate records in my recordset. Is there any explaination for this?

    Chee Hwee.

  • POST THE CODE !!!!

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • Are you connecting to the same server and the same database? (it's caused me a red face from time to time before)

    Is the query exactly the same, no additional clauses?

    Are the connection settings the same?

    Oh, and please post the code and if possible the table structure. It's much easier to help when you have specifics to work with.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 8 posts - 1 through 7 (of 7 total)

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