gpt4 book ai didi

SQL,如何将 VARCHAR 转换为 bigint?

转载 作者:行者123 更新时间:2023-12-02 02:45:14 49 4
gpt4 key购买 nike

我有一个 VARCHAR(6) 字段,我试图将其插入到另一个 bigint 类型的表中,但出现错误

(从数据类型 varchar 转换为 bigint 时出错

这就是我正在做的事情

CONVERT(bigint, seconds) as seconds

有人可以帮忙解决这个问题吗?

最佳答案

这就是答案

(CASE
WHEN
(isnumeric(ts.TimeInSeconds) = 1)
THEN
CAST(ts.TimeInSeconds AS bigint)
ELSE
0
END) AS seconds

关于SQL,如何将 VARCHAR 转换为 bigint?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14636282/

49 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com