Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using ODBC to determine colum

Status
Not open for further replies.

RichardRahl

Programmer
Jul 30, 2007
5
0
0
CA
Hey folks, at the moment I really don't think this is possible but decided to throw it on here to see if there were any ideas.

Essentially, I would like a way to grab any 1) arbitrary table (that I have permissions to) in DBMS that I have an ODBC connection too; 2) A column in that table and determine 3) If there are repeated values in that column.

What I *don't* want to do is check for column uniqueness by doing a query for the column and check manually if there are repeated values by either
1) looping through to check for duplicates ( O(n^2) time )
2) Sorting the column and comparing adjacent values ( like O (n^2 log n) I think)

What I would like an consistent, generic, ODBC-ish way to extract the meta data for the column to determine if it was declared as Unique in the DDL (I know there could also be unique columns not declared in the DDL but I hugely don't care about those) which would tell me in constant O(1) time if it's unique regardless of the DBMS I'm using (that is, in ODBC and not though DBMS-specific data dictionary queries). Actually, I would really like more meta data (e.g. check constraints that may have been DDL'd into the column/table) but I'd be happy for this.

I know about the INFORMATION_SCHEMA views in the ANSI Standard, but there are significant DBMS's that do not support (e.g. Oracle) so it's no good.

Again, I figure this is a dream, but who knows! Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top