如何在DB2中更改列名 [英] How to change the column name in DB2

查看:430
本文介绍了如何在DB2中更改列名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要重命名表之一的列名。我有DB2数据库,我们正在连接数据库并通过Eclipse IDE执行sql查询。

I need to rename the column name of one of the table. I have DB2 database and we are connecting with the database and executing sql queries through Eclipse IDE.

谢谢。

推荐答案

使用ALTER TABLE语句。

Use an ALTER TABLE statement.

ALTER TABLE G31.TG31PDIX RENAME COLUMN RECORD_KEY TO RECORD_KEYY;

仅当您使用支持此功能的DB2版本时,此方法才有效。较旧的版本可能不走运。我不确定他们何时添加它,但是那是在2004年之后。

This will only work if you use a version of DB2 that supports this feature. An older version might be out of luck. I'm not sure when they added it, but it was after 2004.

这篇关于如何在DB2中更改列名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆