我可以将varchar转换为十进制吗?我已经尝试过了,但是收到以下错误:
“函数参数值,类型或计数无效”
adjust2,tax,sss_ee,sss_er,phic
列是我要转换为十进制类型的列。
Dim strQuery As String = "SELECT DATER, CODE, ID, REG_HRS, R_OT, RD_OT, RD_8, HOL_OT," &
" HOL_OT8, ND, ABS_TAR, ADJUST1, GROSS_PAY, CAST(ADJUST2 AS DECIMAL(10,2)), CAST(TAX AS DECIMAL(10,2))," &
" CAST(SSS_EE AS DECIMAL(10,2)), CAST(SSS_ER AS DECIMAL(10,2)), CAST(PHIC AS DECIMAL(10,2)), NET_PAY, REG_PAY FROM [" & dbfFileName & "]"
答案 0 :(得分:0)
我认为这是数据问题,您现有的数据无法转换为十进制。
改为使用TRY_PARSE
。
, COALESCE(TRY_PARSE(ADJUST2 AS DECIMAL(10,2)), 0.00)