日期:2014-05-19  浏览次数:20461 次

查询语句的问题!!!!!!!!!!!!!
declare   @count   int;
declare   @sql   varchar(400);
set   @count   =3;
set   @sql= 'select   *   from   users   where   name   like   '%   s   % '+   ';
exec(@sql)
我要查询name中包含s的记录set   @sql= 'select   *   from   users   where   name   like   +   %   s   %   +   ';该如何写呢?


------解决方案--------------------


declare @count int;
declare @sql varchar(400);
set @count =3;
set @sql= 'select * from users where name like ' '%s% ' ' '
exec(@sql)