Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top