你的位置:首页 > 数据库

[数据库]Sql 存储过程动态添加where条件

declare @bussHallId nvarchar(255)= '2,3'declare @strWhere nvarchar(255)= ''declare @strMain nvarchar(500)if(@bussHallId is not null)  set @strWhere = @strWhere + ' and bh.ID in ([email protected]+')'  set @strMain = ' select * from T_BussHall bhwhere 1 =1 ' [email protected](@strMain)