Page 1 of 1
(WideMemo) in DBControls in Delphi XE
Posted: Fri 21 Sep 2012 17:17
by fellipeh
Hello,
I have these SQL:
Code: Select all
SELECT CC.*,
(CC.Desc || CC.Desc2) AS FK_PLANOPAI_DESC
FROM CAIXA_CONTA CC
where (CC.IDEMPRESA = 1) and
(CC.ANA_SIN = 'A')
ORDER BY CC.IDCAIXA_CONTA
In delphi, FK_PLANOPAI_DESC show me as WideMemo... but all 2 fields is varchar!
Where I mess up?
Regards,
Re: (WideMemo) in DBControls in Delphi XE
Posted: Mon 24 Sep 2012 10:33
by ZEuS
To let the FK_PLANOPAI_DESC field become created as a string field, not as a memo field, you should explicitly specify its type and size in a SQL-statement. For example,
Code: Select all
select cast((CC.Desc || CC.Desc2) as character varying(600)) AS FK_PLANOPAI_DESC
Otherwize, when preparing the statement, PostgreSQL server can not correctly determine the field size, and therefore the field is created as a memo field.
Also, you can use the Data Type Mapping feature to perform such task. Just create a new rule in the TPgQuery.DataTypeMap property editor, set the "Field Name" column value to "fk_planopai_desc" and the "Field Type" column value to "String". You can learn more about data type mapping in the "Working with Data Type Mapping" article in the PgDAC documentation.