最小公倍数

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

DECLARE @num1 BIGINT, 
        @num2 BIGINT 

SET @num1=6 
SET @num2=8

DECLARE @result BIGINT 
DECLARE @max INT 
DECLARE @times INT 

IF @num1 <= @num2 
  SET @max=@num2 
ELSE 
  SET @max=@num1 

SET @times=@max 

WHILE( @times >= @max ) 
  BEGIN 
      IF( @times%@num1 = 0 
          AND @times%@num2 = 0 ) 
        BEGIN 
            SET @result=@times 

            BREAK 
        END 

      SET @times=@times + 1 
  END 

SELECT @result