Files
Fuchs_Intranet/db/dbo.ott_random_int.UserDefinedFunction.sql

30 lines
1.6 KiB
Transact-SQL

USE [site_fuchs]
GO
/****** Object: UserDefinedFunction [dbo].[ott_random_int] Script Date: 02.12.2020 21:05:05 ******/
DROP FUNCTION [dbo].[ott_random_int]
GO
/****** Object: UserDefinedFunction [dbo].[ott_random_int] Script Date: 02.12.2020 21:05:06 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date, ,>
-- Description: <Description, ,>
-- =============================================
CREATE FUNCTION [dbo].[ott_random_int]
(@UPPER int, @LOWER int)
RETURNS int
AS
BEGIN
DECLARE @RET INT = CAST(ROUND(((@UPPER - @LOWER - 1) * (SELECT TOP(1) [rn] FROM [dbo].[ocms_fn_rand]) + @LOWER), 0) as int);
RETURN @RET;
END
GO
ALTER AUTHORIZATION ON [dbo].[ott_random_int] TO SCHEMA OWNER
GO