递归 SQL 函数,<= 运算符不起作用

Recursive SQL function, <= operator doesn't work

我只是想知道为什么会这样。但是我的评论不起作用。

ALTER PROC spFactorial
    @ValueIn int,
    @ValueOut int OUTPUT
AS
    DECLARE @InWorking int;
    DECLARE @OutWorking int;

    IF @ValueIn <> 1            -- this <= doesn't work??
    BEGIN
         SELECT @InWorking = @ValueIn - 1;

         EXEC spFactorial @InWorking, @OutWorking OUTPUT;

         SELECT @ValueOut = @ValueIn * @OutWorking;
    END
    ELSE
    BEGIN
        SELECT @ValueOut = 1;
    END

    RETURN;
GO

DECLARE @WorkingOut int;
DECLARE @WorkingIn int;
SELECT @WorkingIn = 3;

EXEC spFactorial @WorkingIn, @WorkingOut OUTPUT;

PRINT CAST(@WorkingIn AS varchar ) + ' factorial is '
+ CAST(@WorkingOut AS VARCHAR );

这个 IF @ValueIn <= 1 不起作用 - 为什么?

在 C# 或 java 中有效。

谢谢

<= is not an operator in SQL. In c# and Java it is. 

对于 Sql 中的 <= 运算符功能,您可以这样做

IF(@value < 1 OR @value = 1)