Subject | RE: [firebird-support] field type for "varchar" instead of "varying" |
---|---|
Author | Simon Carter |
Post date | 2005-10-17T07:58Z |
> -----Original Message-----You can use a case statement in the SQL, I have added another query at
> when i query field types, i saw that datatype is varying
> instead of varhcar. How can i get it as varhcar? (same for
> long instead of
> integer)
(http://www.fbtalk.net/viewtopic.php?id=16) which uses this method, in
essence:
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;
Hih
Si Carter
http://www.fbtalk.net/
http://www.tectsoft.net/