1

How do I convert an int column to a varchar in FrontBase SQL? I need to concatenate a varchar and an int field, and I cannot just concatenate them because both arguments need to be a varchar.

I wanted to tag this "Frontbase" but I don't have permission due to reputation < 1500.

Server and database version is 4.2.7

The query looks like this:

select (TVERKOPEN.CPREFIX || CAST(TVERKOPEN.CNUMMER AS VARCHAR)) as PurchaseOrder
from TVERKOPEN
Wouter Lievens
  • 4,019
  • 5
  • 41
  • 66

1 Answers1

1

Try with:

CAST(field AS VARCHAR(30))
hsz
  • 148,279
  • 62
  • 259
  • 315
  • I get this error: Exception condition 239. Data exception - string data, right truncation. – Wouter Lievens Sep 04 '12 at 07:46
  • I think I found it... I have to specify VARCHAR(30) or some other length. If you update your answer I can approve it (because it was mostly right). – Wouter Lievens Sep 04 '12 at 07:57
  • However I found `SQL-92` (which is base for FrontBase) documentation about casting and allowed operations: http://db.apache.org/derby/docs/10.2/ref/rrefsqlj33562.html ;-) – hsz Sep 04 '12 at 07:59