Microsoft Knowledge Base Email Alertz

If you call the

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 304394 - Last Review: December 3, 2003 - Revision: 3.1

FIX: Oracle Driver Doesn't Sort SQLPrimaryKeys Result Set by Key Sequence

This article was previously published under Q304394

On This Page

SYMPTOMS

If you call the SQLPrimaryKeys command, and the SchemaName is set to a valid schema name, the Microsoft Oracle Driver does not order the result set that is returned from ODBC Test as expected.

RESOLUTION

To resolve this problem, obtain the latest service pack for Microsoft Data Access Components 2.6. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
300635  (http://kbalertz.com/Feedback.aspx?kbNumber=300635/EN-US/ ) INFO: How to Obtain the Latest MDAC 2.6 Service Pack
To work around this problem, use Oracle's ODBC Driver.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Microsoft Data Access Components 2.6 Service Pack 2.

MORE INFORMATION

According to the ODBC specifications, the result set that SQLPrimaryKeys returns should sort by TABLE_CAT, TABLE_SCHEM, TABLE_NAME, and KEY_SEQ. Although the Microsoft Oracle Driver sorts by catalog and schema followed by table name, the key sequence is left unordered. This problem only occurs when a schema is specified in the SQLPrimaryKeys call ("DEMO") in the following example. If DEMO is not specified but is left as null, the result set is returned in the correct order.

Steps to Reproduce Behavior

  1. From SQL *PLUS, use the following code to create a table:
    create table my_table(col1 int, col2 int, col3 int, primary key(col2, col3,col1));
    					
  2. Open ODBC Test, click Conn from the menu, and then click Full connect. Select the DSN that uses the Microsoft Oracle Driver, and type the User Id and Password.
  3. Click Catalog, and then click SQLPrimaryKeys to invoke SQLPrimaryKeys.
  4. In the TableName drop-down list box, click my_table. In the SchemaName drop-down list box, click a valid schema name, and then click OK to invoke the command. You receive the following error message:
    Return: SQL_SUCCESS=0
  5. Click Results, and then click Get Data All. In the result set, notice that KEY_SEQ appears as "2, 3, 1" instead of the expected "1,2,3".

REFERENCES

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
271852  (http://kbalertz.com/Feedback.aspx?kbNumber=271852/EN-US/ ) BUG: MS Oracle ODBC Driver Truncates Spaces in Column Name

APPLIES TO
  • Microsoft Open Database Connectivity 2.5
  • Microsoft Open Database Connectivity 2.5
  • Microsoft Open Database Connectivity 2.5
  • Microsoft Open Database Connectivity 2.0
  • Microsoft Open Database Connectivity 2.5
  • Microsoft Open Database Connectivity 2.5
  • Microsoft Open Database Connectivity 2.5
  • Microsoft Open Database Connectivity 2.5
  • Microsoft Open Database Connectivity 2.5
  • Microsoft Open Database Connectivity 2.5
  • Microsoft Open Database Connectivity 2.5
  • Microsoft Data Access Components 2.5
  • Microsoft Data Access Components 2.6
  • Microsoft Data Access Components 2.7
Keywords: 
kbbug kbfix kbmdac260sp2fix kboracle KB304394
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate