stored proc - executing a query with NOT IN where clause

后端 未结 5 740
梦谈多话
梦谈多话 2021-01-26 09:58

i have a stored procedure

Create PROCEDURE abc      
  @sRemovePreviouslySelectedWhereClause nvarchar(max)
AS
BEGIN

SELECT * 
      FROM table 
     WHERE nId          


        
5条回答
  •  心在旅途
    2021-01-26 10:03

    You have to split the @sRemovePreviouslySelectedWhereClause parameter by ',' and place the resulting values in a temp table. Then your select would look like

    select * from table where nId not in (select nId from #tempIds)
    

提交回复
热议问题