1

Using the input values from 1 text field (7171, 7496, 7134, 7108, 7105, 7353), how do I create an IN listing for the WHERE clause of my SQL statement. The input text box can have 1 number or multiple numbers that would need to be included in the WHERE-IN clause

  • Probable duplicate of http://stackoverflow.com/questions/337704/parameterizing-an-sql-in-clause – JAQFrost Dec 06 '12 at 18:54
  • Have a look at my answer to this question http://stackoverflow.com/questions/13252072/i-need-an-sp-to-select-or-update-my-tables-and-for-that-i-have-to-enter-multiple/13259949#13259949 which shows how to pass a table variable to a stored procedure to do exactly this – Steve Ford Dec 07 '12 at 16:02

1 Answers1

0
declare @query as nvarchar(max)
declare @text varchar(200)

set @text='80000, 8600'
set @query='select * from Employee where [emp_salary] in ('+@text+')'
--[emp_salary] is integer field 
exec sp_executesql @query