Ich stand heute vor der Frage, wie man am besten ermittelt, ob eine vorliegende Zahl eine Dezimalzahl oder in Integer Wert ist.

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:	Erhard Rainer
-- Create date: 2022-04-04
-- Description:	Ermittelt, ob die übergbene Zahl eine Dezimal-Zahl ist oder nicht
-- =============================================
/*
Select [dbo].[f_MATH_isDecimal]('1.5')
Select [dbo].[f_MATH_isDecimal]('1')
*/
CREATE FUNCTION [dbo].[f_MATH_isDecimal]
(
@Number FLOAT = null
)
RETURNS bit
AS
BEGIN
	DECLARE @Result AS BIT = 1

	IF FLOOR(@Number) = CEILING(@Number)
	BEGIN
		SET @Result = 0
	END 

	RETURN @Result
END
GO