Re: Determining Foreign/Primary Keys in a Table
- From: "Dmitriy Ivanov" <divanov_nospa@xxxxxxxx>
- Date: Thu, 10 May 2007 17:57:51 +0400
Hello Jason,
"Jason D." <Tronman@xxxxxxxxx> wrote:
JD> Hello, I'm looking for a generic way to determine Foreign/Primary
JD> keys for a table in a Database I'm connected to via ODBC. The two
JD> examples I've been working with so far are an Access Database and
JD> an Oracle Database.
JD>
JD> What I've tried so far:
JD>
JD> I can determine Primary Keys (using the System.Data.ODBC controls
JD> in .NET) but not foreign keys.
JD>
JD> Also, I've been trying to use the API-calls SQLPrimaryKeys and
JD> SQLForeignKeys from Visual C++ 6.
JD>
JD> SQLForeignKeys doesn't crash, but doesn't return anything.
JD> SQLPrimaryKeys works properly in Oracle; but Access gives me an
JD> error number of -1 (Driver does not support this function). How
JD> could it not support this? Any why won't ForeignKeys return
JD> anything at all (I have specifically set and committed the foreign
JD> keys).
For the Access driver, you can simulate SQLForeignKeys() by means of
selecting from MSysRelationships table and SQLPrimaryKeys() by means of
SQLSpecialColumns().
For sample code in Lisp, you could take a look at the access-odbc.lisp
source file in the library mentioned below.
--
Sincerely,
Dmitriy Ivanov
Common Lisp ODBC interface - lisp.ystok.ru/ysql.html
.
- References:
- Determining Foreign/Primary Keys in a Table
- From: Jason D.
- Determining Foreign/Primary Keys in a Table
- Prev by Date: Re: 32 bit ODBC in Win XP x64?
- Next by Date: Re: ODBC Connection in Deployement of Integration Services Project
- Previous by thread: Determining Foreign/Primary Keys in a Table
- Next by thread: Re: 32 bit ODBC in Win XP x64?
- Index(es):
Relevant Pages
|