tags:

views:

136

answers:

2

I have the following query in iSeries SQL which I output to a file.

SELECT SSLOTMAK, SSLOTMDL, SSLOTYER, sum(SSCOUNT)
FROM prqhdrss
GROUP BY SSLOTMAK, SSLOTMDL, SSLotyer HAVING sum(SSCOUNT) > 4 ORDER BY SSLOTMAK, SSLOTMDL, SSLOTYER

When I run it, the field created be the sum(SSCOUNT) is a 31 Packed field. This does not allow me to send it to my PC. How can I force SQL to create the field as a non-packed field.

A: 

How are you trying to bring it to your PC? Most iSeries methods I know will automatically convert that to a PC-readable format.

Mike Wills
I'm fairly certain that FTP for one will not convert packed data to a format that's easy to use on the pc side.
Paul G
+2  A: 

Try this

SELECT SSLOTMAK, SSLOTMDL, SSLOTYER, cast(sum(SSCOUNT) as integer)
FROM prqhdrss
GROUP BY SSLOTMAK, SSLOTMDL, SSLotyer
HAVING sum(SSCOUNT) > 4
ORDER BY SSLOTMAK, SSLOTMDL, SSLOTYER

I've casted to integer because of the name of the column "count". If the column has floating-point values you can use numeric(8, 2) instead.

pmg