本文介绍了将nvarchar值'xxxxxx'转换为数据类型int时,如何修复此错误转换失败。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
alter proc SearchDrug
@Criterion nvarchar(50)
as
Select ID_Product as 'Drug ID'
,Label_Product as 'Drug Name'
,Expair_Date as ' Expair Date '
,Qte_In_Stock as 'Quantity'
, Price as 'price'
,DESCRIPTION_CAT as 'Company '
from Products
inner join CATEGORIES
on CATEGORIES.ID_CAT =PRODUCTS.ID_CAT
where ID_Product+LABEL_PRODUCT+CONVERT(varchar,Expair_Date)+Qte_In_Stock
+CONVERT(varchar,Price)+CONVERT(nvarchar,DESCRIPTION_CAT)
like '%' + @Criterion + '%'
什么我试过了:
转换时转换失败将nvarchar值'xxxxxx'转换为数据类型int。
What I have tried:
Conversion failed when converting the nvarchar value 'xxxxxx' to data type int.
推荐答案
Select ID_Product as 'Drug ID'
,Label_Product as 'Drug Name'
,Expair_Date as ' Expair Date '
,Qte_In_Stock as 'Quantity'
, Price as 'price'
,DESCRIPTION_CAT as 'Company '
from Products
inner join CATEGORIES
on CATEGORIES.ID_CAT =PRODUCTS.ID_CAT
where CONVERT(varchar,ID_Product)+LABEL_PRODUCT+CONVERT(varchar,Expair_Date)+Qte_In_Stock
+CONVERT(varchar,Price)+CONVERT(nvarchar,DESCRIPTION_CAT)
like '%' + @Criterion + '%'
WHERE (ID_Product LIKE '%' + @Criterion + '%' )
OR (Label_Product LIKE '%' + @Criterion + '%' )
-- And so on.
这篇关于将nvarchar值'xxxxxx'转换为数据类型int时,如何修复此错误转换失败。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!