0
我無法連接具有不同數據類型的兩列。將數據類型varchar轉換爲數字連接表時出錯
main_ref_id
是char
和person_id
是numeric
查詢:
select
main_ref_id
from
not
where
main_ref_type = 'P'
and convert(numeric(9, 0), main_ref_id) in (select cast(person_id as numeric)
from person_wo_memberships)
錯誤
消息8114,級別16,狀態5,行1個
誤差變換數據類型爲varchar到數字。
任何幫助?
長度,你可以分享你的表結構,你也可以嘗試加入列而不轉換爲數字。只要加入他們作爲字符串。 – gokul
您正在將'main_ref_id'轉換爲NUMERIC(9,0)和'person_id'爲NUMERIC(18,0)。您是否查看了這兩列中的數據以查看是否有非數字值?它們是什麼數據類型?而且我不相信'from from where'語法是合理的。任何其他龍丟失錯誤? – HABO