Recent

Author Topic: [SOLVED] TSQLQuery.ParseSQL strange behavior  (Read 1896 times)

swierzbicki

  • Full Member
  • ***
  • Posts: 177
[SOLVED] TSQLQuery.ParseSQL strange behavior
« on: October 01, 2013, 04:47:18 pm »
Hello,

I'm using TSQLQuery with TPQConnection.
"Calculated SQL fields" are not fetched into TSQLQuery.Fields

Such a basic SQL statement can reproduce the problem :

Code: [Select]
Select
'MY STRING' as MyCalculedField
Table.FieldA,
Table.FiedB
From Table

TSQLQuery.FieldsCount will return 2 instead of 3.
Only physical fields will be fetched and the 'calculated' one will never show.

How can I correct this ?
« Last Edit: October 02, 2013, 10:13:31 am by swierzbicki »
Lazarus 1.6.2
fpc 3.0.0
wince/win32/win64
delphi berlin

LacaK

  • Hero Member
  • *****
  • Posts: 691
Re: TSQLQuery.ParseSQL strange behavior
« Reply #1 on: October 02, 2013, 09:31:47 am »
Try use:
 cast('MY STRING' as char(9)) as MyCalculatedField

swierzbicki

  • Full Member
  • ***
  • Posts: 177
[SOLVED] TSQLQuery.ParseSQL strange behavior
« Reply #2 on: October 02, 2013, 10:13:09 am »
Thank you , this is working :)
Lazarus 1.6.2
fpc 3.0.0
wince/win32/win64
delphi berlin

 

TinyPortal © 2005-2018