June 16, 2006 at 1:07 am
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.
June 16, 2006 at 3:13 am
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
June 16, 2006 at 7:04 am
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.
June 16, 2006 at 7:12 am
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
June 16, 2006 at 1:08 pm
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
June 17, 2006 at 7:36 am
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.
June 19, 2006 at 2:56 am
POST THE CODE !!!!
Tim Wilkinson
"If it doesn't work in practice, you're using the wrong theory"
- Immanuel Kant
June 19, 2006 at 5:09 am
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
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply