-
Retrieve Primary Key in DB2
Hi Again….
How do I determine the Primary Key of a DB2 Table? In SQL Server I can use
ADOX Like So.
Dim catDB As ADOX.Catalog
Dim tblDB As ADOX.Table
Dim colDB As ADOX.Column
Dim idxDB As ADOX.Index
Dim i As Long
Set catDB = New ADOX.Catalog
catDB.ActiveConnection = dbConnection
'Need Way to get Primary key
For Each idxDB In catDB.Tables(TableName).Indexs
If idxDB.PrimaryKey then
sIDX= idxDB.Name
End If
Next
DB2 does not set the Property ‘PrimaryKey’. Is there any other way to retrieve
the Key in a Table?
Thanks in Advance….
-
Re: Retrieve Primary Key in DB2
Hi,
in SYSCAT.COLUMNS view u will find column KEYSEQ ,that tells about the primary
key,infact position in the primary key .
-Manju
"Frost" <stevef@pedco.com> wrote:
>
>Hi Again….
>
>How do I determine the Primary Key of a DB2 Table? In SQL Server I can
use
>ADOX Like So.
>
> Dim catDB As ADOX.Catalog
> Dim tblDB As ADOX.Table
> Dim colDB As ADOX.Column
> Dim idxDB As ADOX.Index
> Dim i As Long
>
> Set catDB = New ADOX.Catalog
> catDB.ActiveConnection = dbConnection
>
>'Need Way to get Primary key
> For Each idxDB In catDB.Tables(TableName).Indexs
>If idxDB.PrimaryKey then
>sIDX= idxDB.Name
> End If
> Next
>
>
>DB2 does not set the Property ‘PrimaryKey’. Is there any other way to retrieve
>the Key in a Table?
>
>Thanks in Advance….
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|