delphin
3rd May 2005, 18:11
:confused: I am writing a SP from tfgld410100 and was wondering how to convert the binary columns into a usable field. Specifically t_dbcr so I can get the correct totals. (If I am reading this correctly the credits still need to be subtracted).

I have tried a couple of things, but am not getting the desired result.

I am running SQL 2000, baan IVc4 with the level 1 driver (hash indexes).

TY for helping a newbie.

vinceco252
4th May 2005, 15:11
I would do something like:
SELECT 'DBCR' =
CASE
WHEN f.t_dbcr = 0x01 THEN f.t_amnt
WHEN f.t_dbcr = 0x02 THEN -(f.t_amnt)
END

FROM ttfgld410100 f

For the comparison, you can also use CAST(f.t_dbcr AS INTEGER) = 1 (for a debit) or CAST(f.t_dbcr AS INTEGER) = 2 (for a credit).

Hope this helps.

Vince

Marius Du Toit
20th May 2009, 07:54
Vince (or any SQL guru)

I have a similar problem with running a sql query against tttxt010.t_text
The result shows 'Binary data'

What function could I use in SQL to convert the content of t_text so that I can use it to produce reports?

I use SQL 2000 - Baan IVc4

Thanks
Marius