[firebase-br] Pegar dados do Banco

eduardo eduardo em icontroller.com.br
Qua Ago 24 09:19:44 -03 2005


Olá Agostinho

Tenta esta besta aí embaixo. Coloque o nome da sua tabela na última linha.

[]s Eduardo

SELECT DISTINCT
     A.RDB$FIELD_POSITION   AS ORDER_ID,
     A.RDB$FIELD_NAME AS F_NAME,
     B.RDB$FIELD_TYPE,
     B.RDB$FIELD_SCALE,
     CASE
         WHEN B.RDB$FIELD_PRECISION > 0 THEN 
'NUMERIC('||CAST(B.RDB$FIELD_PRECISION AS 
VARCHAR(2))||','||CAST(B.RDB$FIELD_SCALE*-1 AS VARCHAR(2))||')'
         WHEN C.RDB$TYPE_NAME='LONG'  THEN 'INTEGER'
         WHEN C.RDB$TYPE_NAME='SHORT' THEN 'SMALLINT'
         WHEN C.RDB$TYPE_NAME='VARYING' THEN 
'VARCHAR('||B.RDB$CHARACTER_LENGTH||')'
         WHEN C.RDB$TYPE_NAME='TEXT' THEN 
'CHAR('||B.RDB$CHARACTER_LENGTH||')'
         WHEN C.RDB$TYPE_NAME='BLOB' THEN 'BLOB SUB_TYPE 
'||CAST(B.RDB$FIELD_SUB_TYPE AS CHAR(1))
     ELSE
         C.RDB$TYPE_NAME
     END AS F_TIPO,
     CASE
         WHEN A.RDB$NULL_FLAG IS NULL  THEN ''
     ELSE
         'NOT NULL'
     END AS F_NULL,
     F.RDB$FIELD_NAME AS F_PRIMARY
FROM
     RDB$RELATION_FIELDS
         A
     LEFT JOIN RDB$FIELDS
         B ON A.RDB$FIELD_SOURCE=B.RDB$FIELD_NAME
     LEFT JOIN RDB$TYPES
         C ON C.RDB$FIELD_NAME='RDB$FIELD_TYPE' AND 
B.RDB$FIELD_TYPE=C.RDB$TYPE
     LEFT JOIN RDB$RELATION_CONSTRAINTS
         E ON A.RDB$RELATION_NAME=E.RDB$RELATION_NAME AND 
E.RDB$CONSTRAINT_TYPE='PRIMARY KEY'
     LEFT JOIN RDB$INDEX_SEGMENTS
         F ON E.RDB$INDEX_NAME=F.RDB$INDEX_NAME AND 
A.RDB$FIELD_NAME=F.RDB$FIELD_NAME
WHERE
     A.RDB$RELATION_NAME = 'SUA_TABELA'





Mais detalhes sobre a lista de discussão lista