I need make this query:
declare @no as varchar(100)
set @no='11,2,23'
select * from ft (nolock) where fno in (@no)
but have this error all the time: Error converting data type varchar to numeric
The fno is numeric in the table
I need make this query:
declare @no as varchar(100)
set @no='11,2,23'
select * from ft (nolock) where fno in (@no)
but have this error all the time: Error converting data type varchar to numeric
The fno is numeric in the table
You can't directly select data like in (@no) since LIKE expects data as a table. Please try:
declare @no nvarchar(max)
set @no='11,2,23'
select * from ft (nolock) where fno in (
SELECT
Split.a.value('.', 'VARCHAR(100)') AS CVS
FROM
(
SELECT
CAST ('<M>' + REPLACE(@no, ',', '</M><M>') + '</M>' AS XML) AS CVS
) AS A CROSS APPLY CVS.nodes ('/M') AS Split(a))