A simple question, just out of curiosity.
For example select 1,2,3, which will show tablewith one columnand three rows.
select 1,2,3
table
one column
three rows
Something like that: select values(1),(2),(3)
select values(1),(2),(3)
* with one select statement
As it turned out, there is a simple code that I was looking for:select n from (values (1),(2),(3)) D(c);
select n from (values (1),(2),(3)) D(c);
An example of my comment in your post.
DECLARE @TABLE TABLE (ONE INT, TWO INT, THREE INT) INSERT INTO @TABLE VALUES (1,2,3) SELECT UP.COL, UP.VALUE FROM @TABLE UNPIVOT (VALUE FOR COL IN (ONE,TWO,THREE)) UP
Query:
DECLARE @t TABLE (i1 INT, i2 INT, i3 INT) INSERT INTO @t VALUES (1, 2, 3) SELECT t.* FROM @t CROSS APPLY ( VALUES(i1), (i2), (i3) ) t(value)
:
value ----------- 1 2 3
http://blog.devart.com/is-unpivot-the-best-way-for-converting-columns-into-rows.html
Source: https://habr.com/ru/post/1524469/More articles:Percentage in slices showing outside ring fragments - c #Confirm rm in zsh - zshSearching a tuple in a list of tuples (sorting by multiple keys) - pythonI can not allow mongo from a remote connection - mongodbProgrammatically create a new category in magento - magentoAccess to _data in Jekyll (loop in loop) - jekyllPackage the entire C # Console application in one file? - c #The path of the current InkScape file from a python script - pythonAjax Control Toolkit ModalPopupExtender not working in Visual Studio 2012 - ajaxasp.net mvc how to transfer a complete model from a view to a controller - c #All Articles