SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
CREATE FUNCTION Quarter(@x FLOAT, @y FLOAT) RETURNS INT AS BEGIN DECLARE @result INT IF @x > 0 AND @y > 0 BEGIN SET @result = 1 END ELSE IF @x < 0 AND @y > 0 BEGIN SET @result = 2 END ELSE IF @x < 0 AND @y < 0 BEGIN SET @result = 3 END ELSE IF @x > 0 AND @y < 0 BEGIN SET @result = 4 END ELSE BEGIN SET @result = 0 -- Если точка на оси END RETURN @result END SELECT dbo.Quarter(5, -3) AS [Четверть]

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear