SELECT [SendTels] FROM [ZW_User_duanxin] where number=1
已知上述sql得出如下电话号码,分别是6条记录
--------------------------
14002727924
14002727924 14002727926
14002727924 14002727926 14002727927
84002727926 84002727927 84002727928 84002727928
84002727924 84002727926 84002727927 84002727928
14002727924 14002727926 14002727927 14002727928 84002727928
--------------------------
用怎样才存储过程可以得到所有电话号码的总和!重复号码也算。
------解决方案--------------------
- SQL code
declare @t table (col ntext)insert into @tselect '10002727920 10002727926 10002727927 10002727928 ' union allselect '10002727920 10002727926 10002727927 10002727928 ' union allselect '10002727920 10002727926 10002727927 10002727928 ' union allselect '80002727926 80002727927 80002727928 11111111111 22222222222 ' union allselect '80002727920 80002727926 80002727927 80002727928' union allselect '10002727920 10002727926 10002727927 10002727928' union allselect '13609303497' union allselect '18609489876' union allselect '18609489876' union allselect '10002627920' union allselect '10002627920' union allselect '10002627920' select sum(ceiling(len(cast(col as varchar(8000)))/12.00)) from @t/*31*/