存储过程中的where in实现

在项目中使用Npoco时发现where in查询总是不能起作用。寻觅了许久终于找到解决方案,特此记录下:

Declare  @p Varchar(500)
Set @p='CoreRole,CorePassword,CoreOnlineUser'
SELECT * FROM [Menus] 
where charindex(','+ModuleName+',',','+@p+',')>0

 

posted @ 2013-12-25 13:45  kelite  阅读(676)  评论(0编辑  收藏  举报