this is how insert into, select is usually working
(example taken from: https://stackoverflow.com/a/576442/101055):
INSERT INTO new_table (Foo, Bar, Fizz, Buzz)
SELECT Foo, Bar, Fizz, Buzz
FROM initial_table
BUT – how to do this if Fizz is not in the initial_table, but is a variable @fizz?
this fails:
INSERT INTO new_table (Foo, Bar, @fizz, Buzz)
SELECT Foo, Bar, Buzz
FROM initial_table
thnx
The insert syntax is
First you name the columns you want to write into and then you select the source