sql server - SQL Error converting data type varchar to numeric -
i need make query:
declare @no varchar(100)
set @no='11,2,23' select * ft (nolock) fno in (@no) but have error time: error converting data type varchar numeric
the fno numeric in table
you can't directly select data in (@no) since like expects data table. please try:
declare @no nvarchar(max) set @no='11,2,23' select * ft (nolock) fno in ( select split.a.value('.', 'varchar(100)') cvs ( select cast ('<m>' + replace(@no, ',', '</m><m>') + '</m>' xml) cvs ) cross apply cvs.nodes ('/m') split(a))
Comments
Post a Comment