Caused by: java.sql.SQLException: 數據類型varchar和varbinary在add運算符中不兼容


這個問題一般是在SQL Server中使用【+】運算符連接常量字符串和變量字符串的場景下出現。

解決的方法就是使用內置的concat()函數來進行字符串連接操作。

比如將:

select * from yanggb where name like '%' + :name

替換為:

select * from yanggb where name like concat('%', :name)

這樣就解決了報錯問題。

 

"i will grow up alone."


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM