将列数据类型从 DECIMAL(9,0) 更改为 DECIMAL(15,0) [英] Changing column datatype from DECIMAL(9,0) to DECIMAL(15,0)
问题描述
你能帮我解决这个问题吗(我没有在 Teradata 文档中找到它,老实说这有点让人不知所措):我的表有这个列 -BAN DECIMAL(9,0)-,现在我想将其更改为 - BAN DECIMAL(15,0) COMPRESS 0.- 我该怎么做?COMPRESS 约束 0. 或任何其他意味着什么?我希望这是可能的,我不必创建一个新表然后从旧表复制数据.该表非常大 - 当我对该表执行 COUNT(*) 时,我收到此错误:计算期间发生 2616 数字溢出
Can you please help me concerning this matter (I didn´t found it in the Teradata documentation, which is honestly little overwhelming): My table had this column -BAN DECIMAL(9,0)-, and now I want to change it to - BAN DECIMAL(15,0) COMPRESS 0.- How can I do it? What does COMPRESS constraint 0. or any other mean anyway? I hope this is possible, and I don`t have to create a new table and then copy the data form the old table. The table is very very big - when I do COUNT(*) form that table I get this error: 2616 numeric overflow occurred during computation
推荐答案
ALTER TABLE 的语法图似乎不支持直接更改列的数据类型.(Teradata SQL DDL 文档).COMPRESS 0
压缩零.Teradata 支持多种不同类型的压缩.
The syntax diagram for ALTER TABLE doesn't seem to support directly changing a column's data type. (Teradata SQL DDL Documentation). COMPRESS 0
compresses zeroes. Teradata supports a lot of different kinds of compression.
这里的数字溢出可能意味着您已经超出了整数的范围.为了使这部分工作,只需尝试转换为更大的数据类型.(您无需更改列的数据类型即可执行此操作.)
Numeric overflow here probably means you've exceeded the range of an integer. To make that part work, just try casting to a bigger data type. (You don't need to change the column's data type to do this.)
select cast(count(*) as bigint)
from table_name;
这篇关于将列数据类型从 DECIMAL(9,0) 更改为 DECIMAL(15,0)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!