David
David

Reputation: 33

Setting Format for Query Defined Field

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.

Upvotes: 3

Views: 289

Answers (2)

pmg
pmg

Reputation: 108968

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.

Upvotes: 3

Mike Wills
Mike Wills

Reputation: 21255

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

Upvotes: 0

Related Questions