Subject | Re: Looking for tables and columns. |
---|---|
Author | tomconlon7777777 |
Post date | 2005-11-14T07:34:15Z |
--- In firebird-support@yahoogroups.com, "Adam" <s3057043@y...> wrote:
information when they are *based on domains*?
Tom
>Does anyone have a similar system statement that shows column
> Of course you could hunt through the system tables if you really
> wanted.
>
> SELECT RDB$RELATION_NAME AS TABLE_NAME
> FROM RDB$RELATIONS
> WHERE RDB$SYSTEM_FLAG = 0
> AND RDB$VIEW_SOURCE IS NULL;
>
> Gives you all your tables.
>
> SELECT RF.RDB$FIELD_NAME AS FieldName,
> CASE
> WHEN T.RDB$TYPE_NAME = 'VARYING' THEN 'VARCHAR'
> WHEN T.RDB$TYPE_NAME = 'TEXT' THEN 'CHAR'
> WHEN T.RDB$TYPE_NAME = 'INT64' THEN 'BIGINT'
> WHEN T.RDB$TYPE_NAME = 'LONG' THEN 'INTEGER'
> ELSE
> T.RDB$TYPE_NAME
> END AS DataType,
> F.RDB$FIELD_LENGTH AS FieldLength,
> RF.RDB$NULL_FLAG AS AllowNulls,
> CS.RDB$DEFAULT_COLLATE_NAME AS CharacterSet,
> RF.RDB$DEFAULT_SOURCE AS DefaultValue,
> F.RDB$COMPUTED_SOURCE AS ComputedSource,
> F.RDB$FIELD_SUB_TYPE AS SubType,
> F.RDB$FIELD_PRECISION AS FieldPrecision
> FROM RDB$RELATION_FIELDS RF
> LEFT JOIN RDB$FIELDS F ON (F.RDB$FIELD_NAME = RF.RDB$FIELD_SOURCE)
> LEFT JOIN RDB$TYPES T ON (T.RDB$TYPE = F.RDB$FIELD_TYPE)
> LEFT JOIN RDB$CHARACTER_SETS CS ON (CS.RDB$CHARACTER_SET_ID =
> F.RDB$CHARACTER_SET_ID)
> WHERE RF.RDB$RELATION_NAME = 'EMPLOYEE' AND
> T.RDB$FIELD_NAME = 'RDB$FIELD_TYPE'
> ORDER BY RF.RDB$FIELD_POSITION;
>
> Gives the field information for a given table.
>
> You can pull these apart and design your own if you ***really***
> wanted. Personally, I think it is less work for all concerned to
> simply run a query and interpret the exception.
>
> Adam
information when they are *based on domains*?
Tom