因为你定义了@Var_str char(15),既然定义长度为15,返回值当然是15了。改为:
WHILE @Var_position <= Length(@Var_str)
试试祝你好运!

解决方案 »

  1.   

    另外TO pilicat(delphi迷) :WHILE @Var_position <= Length(@Var_str)这个在SQL2000里不合语法,因为没有Length()函数只有datalength()函数
      

  2.   

    把DECLARE @Var_position int, @Var_str char(15)
     改成DECLARE @Var_position int, @Var_str varchar(15)
     就可以了.(循环10次)
      

  3.   

    DECLARE @Var_position int, @Var_str char(15)SET @Var_position = 1
    SET @Var_str = 'SQL SERVER'WHILE @Var_position < LEN(@Var_str)
       BEGIN
        --select 1 
       SET @Var_position = @Var_position + 1
       END