Reputation: 57
Now I know how to select the outputs of a column into a table
select column1, column2 into #temptable
now, what if I just want to input the values myself into the table?
I know that
select 'a' [column1] into #temptable
works
and
select 'a' [column1] into #temptable
union
select 'b' [column1]
also works
but surely there's a less braindead way to get multiples lines of text into a row in SQL.
Upvotes: 1
Views: 61
Reputation: 14228
You might need Desired table
select v.value
into #temptable
from (
values ('a'), ('b'), ('c')
)v(value);
or
select 'a' as Value
into #temptable2
insert into #temptable2
values ('b'), ('c')
Upvotes: 1
Reputation: 1270021
Do you just want values()
?
select v.*
into #temptable
from (values ('a'), ('b')) v(column1);
Upvotes: 0