Convert DT_BYTES to Integer

Viewed 74

I need to read a Microfocus CoBOL data file (on PC) containing COMP fields. FYI, a COMP stores an integer in binary format.

If I transfer the raw binary in SQL Server, I can convert it to a BigInt using CONVERT(bigint,compField,1).

That way, CONVERT(bigint,0x0000002B17,1) will become 11031.

I also need to deal with negative values. In T-SQL it looks like this:

CONVERT(bigint,0xFFFFFFD4E9,1) - CONVERT(bigint,0xFFFFFFFFFF,1)-0x0000000001

will give -11031.

Is there a way to do this directly in the data flow? I'm sure the info is out there somewhere, but I'm too dumb to find it.

I'm working with SSIS 2019 btw.

Thank you!

Simon.

0 Answers
Related