-2
我想在報表生成器使用LIKE和我得到這個錯誤:錯誤在報表生成器使用LIKE時
An error occurred while reading data from the query result set.
Conversion failed when converting the varchar value '%' to data type int.
(Microsoft SQL Server, Error: 245)
這是我的代碼:
select count(*) from projects where received LIKE '%'[email protected]+'%'
and institution# = @institution and program# = @program
我怎麼能解決這個問題?
你可能需要顯式轉換'@ Received'爲varchar - '從哪裏接到LIKE '%' + CONVERT(VARCHAR(10),@received)+'% 」。 – GarethD
謝謝你,我使用你的解決方案,它是工作。 –
CONVERT是SQL Server特有的,CAST是ANSI。 –