SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
; DECLARE @BaseNumber INT = 5, @Result BIGINT = 1; ;WITH cte AS ( SELECT TOP (@BaseNumber) ROW_NUMBER() OVER (ORDER BY (SELECT 0)) AS [Num] FROM sys.columns ORDER BY Num ) SELECT @Result *= [Num] FROM cte; SELECT @Result; -- 120

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear