I want to SELECT multiple rows and then INSERT them INTO another table/database.
My current query only works with 1 result, I need it to work with for example, 100:
DECLARE @var INT;
SELECT
@var = column
FROM
database.dbo.table1
-- this will produce for example, 100 results
IF (@var IS NULL) -- which it is all 100 times
INSERT INTO database.dbo.table2
(column)
VALUES
(@var)
How do I do this, can this even be done?
I'm using Microsoft SQL Server Management Studio 2016.