Consultor Eletrônico



Kbase P100012: How to find the table and field associations within SQL92?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   28/10/2005
Status: Verified

GOAL:

How to find the table and field associations within SQL92?

GOAL:

How to find what fields belong to a particular table in SQL-92?

FIX:

One way to accomplish this in SQL-92 is to perform two queries to find all the fields which are part of a table.

First:
SELECT ROWID FROM pub."_file" WHERE "_file-name" = '<table-name>';

<table-name> is the name of the table whose fields are to be retrieved.

The above query will yield a rowid number. Use the rowid number in the following query:

SELECT * FROM pub."_field" WHERE "_file-recid" = <rowid>;

For example, run this statement against a copy of the sample sports2000 database in SQL Explorer:

SELECT * FROM pub."_field" WHERE "_file-recid" = (SELECT ROWID FROM pub."_file" WHERE "_file-name" = 'department');