Converting Columns into rows with their respective data in sql server -


I have a scenario where I want to convert columns of columns into rows such as tables - stocks:

  scriptname scriptcode value ---------------------------------------- - 20 μm 533022 39   

I need to represent the table in the following format, but I need this kind of representation for a line

  ColName ColValue --------------------------- Scrip Tnam 20 micron Skripk 533,022 price 39   

So I data could bind directly Datistist control.

  declare @ t table (script name varchar (50), scripcode varchar (50) , Value int) in the @T Value ('20 μm ',' 533022 ', 39), select the' script name 'as the callname, @Try the name as a callwall from the union, as ColName All 'Scripps Code', as ColCalue @T Union, as scriptcode, ColName, Dali (value as Varchar (50)) as ColValue @T    

Comments