Teradata SQL 将 decimal 转换为 bigint
Teradata SQL Cast decimal to bigint
我正在尝试 运行 具有 3 个内部联接的 select 语句。最后一个 join 是 decimal 到 bigint 的转换。我正在尝试将小数转换为 bigint,但我仍然收到 theis 错误:
准备期间出错
S1000(-3754)[Teradata][ODBC Teradata 驱动程序]FLOAT 类型常量或隐式转换期间的 Teradata DatabasePrecision 错误。 (0.29 秒)
这是我的查询。我不明白我做错了什么。有人可以帮忙吗?
Select
acct,
tramt,
TRINITDT,
trprocdt,
TRAN_CD,
TDDESC_1,
TDDESC_2,
MICM_TRAN_DESC,
LDGR_TYP_CD
from deposit.F_HRC_DPS_ACCT_TRAN_EOM as T
INNER JOIN customer.Cust_ACCT CA ON T.acct = CA.acct_NB
inner join customer.CUST_IP_X_AR cipx on ca.cust_ar_id = cipx.cust_ar_id
inner join customer.cust c on Cast(cipx.cust_ip_id as bigint) = c.cust_ip_id
where Cast(cipx.cust_ip_id as int) in
(select top 50 Cast(cipx.cust_ip_id as bigint) from customer.cust)
更新:我将内部连接更改为此。还是一样的错误。
INNER JOIN customer.Cust_ACCT CA ON T.acct = CA.acct_NB
inner join customer.CUST_IP_X_AR cipx on ca.cust_ar_id = cipx.cust_ar_id
inner join customer.cust c on CAST(CAST(cipx.cust_ip_id AS numeric (27,0)) AS bigint)= c.cust_ip_id
where CAST(CAST(cipx.cust_ip_id AS numeric (27,0)) AS bigint) in
(select top 50 CAST(CAST(cipx.cust_ip_id AS numeric (27,0)) AS bigint) from customer.cust)
使用CAST(CAST(column AS numeric (27,0)) AS bigint)
.
Select
acct,
tramt,
TRINITDT,
trprocdt,
TRAN_CD,
TDDESC_1,
TDDESC_2,
MICM_TRAN_DESC,
LDGR_TYP_CD
from deposit.F_HRC_DPS_ACCT_TRAN_EOM as T
INNER JOIN customer.Cust_ACCT CA ON T.acct = CA.acct_NB
inner join customer.CUST_IP_X_AR cipx on ca.cust_ar_id = cipx.cust_ar_id
inner join customer.cust c on CAST(CAST(cipx.cust_ip_id AS numeric(27,0)) AS bigint) = c.cust_ip_id
where CAST(CAST(cipx.cust_ip_id AS numeric(27,0)) AS bigint) in
(select top 50 CAST(CAST(cipx.cust_ip_id AS numeric(27,0)) AS bigint) from customer.cust)
我正在尝试 运行 具有 3 个内部联接的 select 语句。最后一个 join 是 decimal 到 bigint 的转换。我正在尝试将小数转换为 bigint,但我仍然收到 theis 错误:
准备期间出错 S1000(-3754)[Teradata][ODBC Teradata 驱动程序]FLOAT 类型常量或隐式转换期间的 Teradata DatabasePrecision 错误。 (0.29 秒)
这是我的查询。我不明白我做错了什么。有人可以帮忙吗?
Select
acct,
tramt,
TRINITDT,
trprocdt,
TRAN_CD,
TDDESC_1,
TDDESC_2,
MICM_TRAN_DESC,
LDGR_TYP_CD
from deposit.F_HRC_DPS_ACCT_TRAN_EOM as T
INNER JOIN customer.Cust_ACCT CA ON T.acct = CA.acct_NB
inner join customer.CUST_IP_X_AR cipx on ca.cust_ar_id = cipx.cust_ar_id
inner join customer.cust c on Cast(cipx.cust_ip_id as bigint) = c.cust_ip_id
where Cast(cipx.cust_ip_id as int) in
(select top 50 Cast(cipx.cust_ip_id as bigint) from customer.cust)
更新:我将内部连接更改为此。还是一样的错误。
INNER JOIN customer.Cust_ACCT CA ON T.acct = CA.acct_NB
inner join customer.CUST_IP_X_AR cipx on ca.cust_ar_id = cipx.cust_ar_id
inner join customer.cust c on CAST(CAST(cipx.cust_ip_id AS numeric (27,0)) AS bigint)= c.cust_ip_id
where CAST(CAST(cipx.cust_ip_id AS numeric (27,0)) AS bigint) in
(select top 50 CAST(CAST(cipx.cust_ip_id AS numeric (27,0)) AS bigint) from customer.cust)
使用CAST(CAST(column AS numeric (27,0)) AS bigint)
.
Select
acct,
tramt,
TRINITDT,
trprocdt,
TRAN_CD,
TDDESC_1,
TDDESC_2,
MICM_TRAN_DESC,
LDGR_TYP_CD
from deposit.F_HRC_DPS_ACCT_TRAN_EOM as T
INNER JOIN customer.Cust_ACCT CA ON T.acct = CA.acct_NB
inner join customer.CUST_IP_X_AR cipx on ca.cust_ar_id = cipx.cust_ar_id
inner join customer.cust c on CAST(CAST(cipx.cust_ip_id AS numeric(27,0)) AS bigint) = c.cust_ip_id
where CAST(CAST(cipx.cust_ip_id AS numeric(27,0)) AS bigint) in
(select top 50 CAST(CAST(cipx.cust_ip_id AS numeric(27,0)) AS bigint) from customer.cust)