sql - How can show one Row in rows in which each row contain column name and the other conatin the value? -


I have a table that contains approximately 60 columns and if I show the query, then in the query analyzer Ask a question and I have to scroll to show the data ..
How can I get a line in which it shows as 60 lines, for each column column name, 2 columns for one and another value For example, the table from select * ID = 1 as default to it

  id call 1 call 2 col 3 call 4 call 5 is shown as ... call 60 1 v1 v2 v3 v4 v5. ..... v60  

I want to show it as

  id1 call 1 v1 call 2 v2 call 3 v3 ... Col60 v60  

What do you need for the stored procedure

  The process of making [dbo] [Rotat] - Add parameters to the stored function here @ Where Novwar (Max), @BabelNameAnnouncement (Max) Start as @classcllity NewWorker (max), @ColumnName nameserver (255) DECLARE @TempT enabled table (ID IDIT ITIT (1,1), CallNew Newcastle (255), Column Value Detection) Insert in @TempTable (Columnname) from info_schema.column Selection column_name where table_name = @tableName @ index set @ index C = 1; Announce @QtterIt @Comment from @TempTable = ID = ID (ID) @columnValue nvarchar (255) Announce @Paradif Navarre (maximum) Announce @string nvarchar (max) WHILE @ index & lt; = @Count BEGIN @ColumnName = Select ColumnName from @TempTable where id = @ Indix set @string = 'select @ ret = cast (' +columnName + 'as nvarchar (255)) to' @ @ @namename 'WHERE Output 'EXCUTE sp_executesql @string, @ paraDef, @ ret = @ ColumnValue Output Update @TempTable SET column value = @columnValue WHERE id = @ index set @ index =' @ @ here set @ paraf = n '@ nvarchar (255) Choose from @index + 1END @TempTableEND * Code>  

Just call it a pass table name and its status, which will return a line for example

  EXEC [dbo] [Rotat] @Where = 'UserID = 123456', @tableName = 'User'  

Comments