Last active
February 7, 2018 18:06
-
-
Save royashbrook/a26f23c6364670205b48d5f98e113456 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- temp table variable | |
declare @tbl table ( | |
a varchar(2) | |
) | |
insert @tbl | |
select 'v0' | |
union all select 'v1' | |
union all select 'v2' | |
select | |
* | |
from | |
@tbl | |
-- in line query | |
select | |
* | |
from | |
( | |
select [a] = 'v0' | |
union all select 'v1' | |
union all select 'v2' | |
) t | |
-- xml variable | |
declare @xml xml | |
set @xml = '<a>v0</a><a>v1</a><a>v2</a>' | |
select | |
[a] = t.c.value('.','varchar(2)') | |
from | |
@xml.nodes('/a ') t (c) | |
-- table value constructor | |
select | |
* | |
from | |
(values ('v0'), ('v1'), ('v2')) v(a) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment