ALTER FUNCTION [dbo].[ufn_Random] ( @A INT, @B INT ) RETURNS INT AS BEGIN /* 功能:生成随机数 */ DECLARE @M INT,@N INT,@R DECIMAL(18,2) SELECT @M=0,@N=1 SELECT @R=RandValue*(@A-@B)+@B FROM VW_RAND SET @R=CAST(ROUND(@R,0) AS INT) RETURN(@R) END