设置查询定义字段的格式

发布于 2024-07-06 14:03:52 字数 427 浏览 7 评论 0原文

我在 iSeries SQL 中有以下查询,并将其输出到文件中。

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

当我运行它时,创建的字段 sum(SSCOUNT) 是一个 31 Packed 字段。 这不允许我将其发送到我的电脑。 如何强制 SQL 将字段创建为非压缩字段。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

末蓝 2024-07-13 14:03:52

尝试一下,

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

由于列的名称“count”,我已将其转换为整数。 如果该列具有浮点值,您可以使用 numeric(8, 2) 代替。

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.

慈悲佛祖 2024-07-13 14:03:52

您打算如何将其移植到您的电脑上? 我知道的大多数 iSeries 方法都会自动将其转换为 PC 可读格式。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文