提供了一个参数,比如是:Progress32,我想把后面两位拆出来,然后使用这两个数字进行一个嵌套循环,得到其他的字段名称。
这样我就可以了:
while (i<=3)
 begin
   while(j<=2)
      begin
      endend

解决方案 »

  1.   


    select right('Progress32',2)
    32
      

  2.   

    declare @ref varchar(100)
    set @ref='Progress32'
    declare @i int,j int
    set @i=cast(left(right(@ref,2),1) as int)
    set @j=cast(right(@ref,1) as int)
    while (i <=@i) 
    begin 
      while(j <=@j) 
          begin 
          end end
      

  3.   

    DECLARE @STR VARCHAR(20)
    DECLARE @I INT, @J INTSET @STR='Progress32'
    SET @J=RIGHT(@STR,1)
    SET @I=SUBSTRING(@STR,LEN(@STR)-1,1)SELECT @I AS I,@J AS J
      

  4.   

    while (i <=left(right('Progress32',2),1)) 
    begin 
      while(j <=right('Progress32',2)) 
          begin 
          end end
      

  5.   


    declare @str varchar(30)
    declare @i int
    declare @j int
    select @str=right('Progress32',2)
    select @i=cast(substring(@str,1,1) as int)
    select @j=cast(substring(@str,2,1) as int)
    while @i<=3
    Begin
        while @j<=2
        begin
        end
    End
      

  6.   

    DECLARE @A INT 
    DECLARE @B INT 
    SELECT @A=RIGHT(RTRIM('PROGRESS32'),1)
    SELECT @B=LEFT(RIGHT(RTRIM('PROGRESS32'),2),1)
    WHILE(I<@B)
    BEGIN
        WHILE(J<@A)
        BEGIN    END
    END
      

  7.   


    declare @ref varchar(100)
    set @ref='Progress32'
    declare @i int,j int
    set @i=cast(right(@ref,2) as int)/10
    set @j=cast(right(@ref,1) as int)
    while (i <=@i) 
    begin 
      while(j <=@j) 
          begin 
          end end