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

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -