vendredi 16 octobre 2015

Is there a method for outputting a single row into a series of columns?

I am white box testing a single row for a wide table on our database (something we do for pretty much every large development).

So we do a simple select by the primary key:

SELECT * FROM MYTAB WHERE MYKEY = 42;

This yields a large number of columns (for the sake of this example, let's say 26 - please don't get hung up on the data, this is purely for example).

Alpha . . . Zulu
-----       ----
237902      RABBIT

(1 row(s) affected)

Is there a way of outputting such so that each column gets it's own output so:

Alpha
-----
237902

(1 row(s) affected)
.
.
.
Zulu
----
RABBIT

(1 row(s) affected)

Or where each column is forced onto the next line so:

Alpha
-----
237902
.
.
.
Zulu
----
RABBIT

(1 row(s) affected)

I am using SQL Server Management Studio.

Aucun commentaire:

Enregistrer un commentaire