T-SQL Round Up function

Because I could not find one on the Internet:

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Phil Hannent
-- Create date: 29/10/2007
-- Description: Round up
-- =============================================
CREATE FUNCTION udfRoundUp
(
@Num1 FLOAT
)
RETURNS FLOAT
AS
BEGIN
DECLARE @Temp FLOAT
SET @Temp = 0

IF @Num1 - CAST(ROUND(@Num1, 0) AS FLOAT) > 0
BEGIN
SET @Temp = 1
END

RETURN ROUND(@Num1, 0) + @Temp

END
GO

Popular posts from this blog

Windows Server and the Task Scheduler Error Code 0x3

The living wage failure

IDE's and speed