将字段描述添加到 DB2/400 文件

发布于 2024-07-30 19:11:50 字数 356 浏览 2 评论 0原文

我在 AS/400/iSeries/System-I/whatever-IBM-wants-me-to-call-it-these-days 上的库中有一组文件,我没有 DDS(在 SQL I 中创建)收集)但我想添加字段描述。 我找不到在 400 上执行此操作的方法。

有谁知道如何添加字段描述? 直接更新 SYSIBM.SQLCOLUMNS 以设置 COLUMN_TEXT 安全吗?

(我不是在这里寻找一般的 SQL 答案,而是寻找 DB2/400 特定的答案。不幸的是,考虑到 IBM 对该平台的重命名以及他们选择的非常无法通过谷歌搜索的名称,几乎不可能找到答案(或者特别是要证明这一点)没有答案)这些问题无需花费大量时间查看大量、难以理解的文档)

I have a set of files in a library on an AS/400/iSeries/System-I/whatever-IBM-wants-me-to-call-it-these-days which I do not have DDS for (created in SQL I gather) but to which I would like to add field descriptions. I cannot find a way to do this on the 400.

Does anyone know how I can add field description? Is directly updating SYSIBM.SQLCOLUMNS to set COLUMN_TEXT safe?

(I am not looking for general SQL answers here, only DB2/400 specific answers. Unfortunately given IBMs renamings of this platform and the very un-google-able name they chose, it is almost impossible to find answers (or especially to prove that there is NOT an answer) to such questions without spending ages looking through there voluminous, impenetrable documentation)

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

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

发布评论

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

评论(2

情徒 2024-08-06 19:11:50

使用LABEL SQL 命令。 如果您使用的是绿屏 STRSQL 命令,则可以提示它。 LABEL 命令可用于设置列文本和列标题。

下面是使用 LABEL 命令为名为 TESTFILE1 的文件中的两个字段提供列文本的示例。 在本例中,字段被命名为FIELD1和FIELD2:

LABEL ON COLUMN TESTFILE1 
(FIELD1 TEXT IS 'My Field 1 text', FIELD2 TEXT IS 'My Field 2 text')

下面是使用LABEL命令给出将在查询结果中显示的列标题的示例:

LABEL ON COLUMN TESTFILE1
(FIELD1 IS 'My field            Heading 1',
 FIELD2 IS 'My field            Heading 2')

创建列标题时,每个字段有60个字符。 前 20 个字符是第 1 行。后 20 个字符是第 2 行。第三个 20 个字符是第 3 行。在上面的示例中,字段标题如下所示:

My field     My field
Heading 1    Heading 2

Use the LABEL SQL command. If you are using the green-screen STRSQL command, you can prompt it. The LABEL command can be used to set both column text and column headings.

Here is an example of using the LABEL command to give column text for two fields in the file named TESTFILE1. The fields are named FIELD1 and FIELD2 in this example:

LABEL ON COLUMN TESTFILE1 
(FIELD1 TEXT IS 'My Field 1 text', FIELD2 TEXT IS 'My Field 2 text')

Here is an example of using the LABEL command to give column headings that would show up in query results:

LABEL ON COLUMN TESTFILE1
(FIELD1 IS 'My field            Heading 1',
 FIELD2 IS 'My field            Heading 2')

When creating column headings, you get 60 characters per field. The first 20 characters are line 1. The second 20 characters are line 2. The third 20 characters are line 3. In the above example, the field headings would look like this:

My field     My field
Heading 1    Heading 2
云淡月浅 2024-08-06 19:11:50

作为附加提示,您可以使用 iSeries Navigator 获取该文件的 SQL 语句。 如果您启动该程序,登录到 iSeries,转到数据库,转到模式,然后转到表,然后您就可以找到您的文件。 您会在某处找到“生成 SQL”按钮。 这将为您创建一个精确的 SQL 语句来创建表。 您可以使用此 SQL 语句来处理该表。

对于您的问题,另一个答案中的“标签”就足够了。 如果您想做更多 ALTER 无法完成的事情,这个答案很有用。

As an additional hint, you can use iSeries Navigator to get the SQL statement for that file. If you fire up this program, log on to the iSeries, go to database, go to schemas, and go to tables, then you can find your file. You'll find the button "generate SQL" somewhere. This creates an exact SQL statement for you to create the table. You can use this SQL statement to work with this table.

For your questions, the "LABEL" from another answer is sufficient. This answer is usefull if you want to do more stuff, that can not be done with ALTER.

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