Subject Column Types
Author AngelBlaZe
I use the following query:
a.rdb$field_name as name,
coalesce(a.rdb$null_flag,0) as "isnotnull",
a.RDB$DEFAULT_SOURCE as dflt_value,
b.rdb$CHARACTER_LENGTH as "length",
b.rdb$field_scale as scale,
b.rdb$field_sub_type as subtype,
b.rdb$field_precision as "precision",
b.rdb$field_type as type,
iif(position('RDB$' in b.rdb$field_name) = 0,b.rdb$field_name,null) as "domain",
1 as pk,
a.RDB$FIELD_SOURCE as fsource,
a.rdb$description as description

from rdb$relation_fields a,
rdb$fields b where a.rdb$field_source = b.rdb$field_name
and a.rdb$relation_name = 'YOURTABLENAME' order by a.rdb$field_position asc

You then have to use that information to get to the definition.

for example
a decimal(10,5) column
would have using the query above:
type = 16 And subtype = 2
precision = 10
scale = 5

some common types:
typemap(8) = ddTypes.aInteger
typemap(37) = ddTypes.aString
typemap(7) = ddTypes.aSmallInt
typemap(16) = ddTypes.aDecimal
typemap(12) = ddTypes.aDate
typemap(35) = ddTypes.aDateTime
typemap(261) = ddTypes.aByte

I don't know if there is a reference for this, I just reverse engineered it from known columns.

Hope it helps.

--- In, "Matteo Pasqualini" <pasqua91@...> wrote:
> hi i’m an IT student and i’ve got problems about using System Tables to get information abiut my database. i’ve got some questions and i can’t find any answer.
> my questions are :
> - how can i get the field type of a specific field in the table?
> for example if i create a table with a field named “test” and type “Decimal (10,5)” how can i get “Decimal (10,5)” using System Tables?
> - how can i get the domain name that i create?
> for example if i create a domain named “YES_NO” how can i get “YES_NO” with System Tables?
> thanks in advance
> [Non-text portions of this message have been removed]