用最简单的方法求出数字1的个数 ...散点分
 declare   @a   table(id   int)   
 insert   into   @a   select   1 
 union   all 
 select   11 
 union   all 
 select   121 
 union   all 
 select   121 
 union   all 
 select   2311 
 union   all 
 select   1232311 
 union   all 
 select   112311 
 union   all 
 select   12311 
 select   *   from   @a
------解决方案--------------------create table a(id int)   
 insert into a select 1 
 union all 
 select 11 
 union all 
 select 121 
 union all 
 select 121 
 union all 
 select 2311 
 union all 
 select 1232311 
 union all 
 select 112311 
 union all 
 select 12311   
 declare @n int 
 set @n = 0 
 select @n = @n + len(id) - len(replace(id,1, ' ')) from a 
 select @n 
------解决方案--------------------  declare @a table(id int)   
 insert into @a select 1 
 union all 
 select 11 
 union all 
 select 121 
 union all 
 select 121 
 union all 
 select 2311 
 union all 
 select 1232311 
 union all 
 select 112311 
 union all 
 select 12311   
 select sum(len(cast(id as varchar))-len(replace(cast(id as varchar), '1 ', ' '))) from @a   
 --结果 
 -----------  
 19   
 (所影响的行数为 1 行) 
------解决方案--------------------路过,学习ing