简体   繁体   English

如何查找SQL查询行大小

[英]How to find sql query row size

I am running into SQL issue 我遇到了SQL问题

DB2 SQL Error: SQLCODE=-1585, SQLSTATE=54048 DB2 SQL错误:SQLCODE = -1585,SQLSTATE = 54048

I already have 32K temp table space. 我已经有32K临时表空间。 I want to figure out what is the row size of my SQL query, so that I can quickly found out, how much I am going beyond 32K. 我想弄清楚我的SQL查询的行大小是多少,以便可以快速找出我要超出32K多少。

From the DB2 Command Line Processor, you can use describe for an SQL statement: 在DB2命令行处理器中,可以对SQL语句使用describe

$ db2 "describe select tabschema,tabname from syscat.tables"

 Column Information

 Number of columns: 2

 SQL type              Type length  Column name                     Name length
 --------------------  -----------  ------------------------------  -----------
 448   VARCHAR                 128  TABSCHEMA                                 9
 448   VARCHAR                 128  TABNAME                                   7

You're interested in the Type length column. 您对“ 类型长度”列感兴趣。 For the example SQL statement here, it's 256 bytes. 对于此处的示例SQL语句,它为256个字节。

Obviously, use your own query. 显然,使用您自己的查询。

describe is not a SQL statement, so it's not available to applications connecting via JDBC or ODBC. describe不是SQL语句,因此它不适用于通过JDBC或ODBC连接的应用程序。 I'm not sure if there are metadata methods you can call on a prepared statement to get the equivalent information. 我不确定是否有元数据方法可以调用准备好的语句来获取等效信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM