I am trying to build a loop with SQL Server.
When I execute SELECT 1 UNION SELECT 2 UNION SELECT 3; SQL Server creates a table with 1 column and 4 rows.
Can anyone think of a way to achive the same however without using UNION?
You can use the values() table constructor:
select *
from (values (1), (2), (3), (4)) v(n);
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With