Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用来自 1 个文本字段(7171、7496、7134、7108、7105、7353)的输入值,如何为我的 SQL 语句的 WHERE 子句创建一个 IN 列表。输入文本框可以有 1 个或多个需要包含在 WHERE-IN 子句中的数字
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