将Sql表列转换为行 [英] Convert Sql table columns to rows

查看:100
本文介绍了将Sql表列转换为行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有包含动态列的表我希望该列被视为行及其对应的值在他们面前



我该怎么办?

i尝试使用枢轴,但我可以为有限的列做到这一点



其他告诉我如何在gridview上显示它而不是结果

I have table which contains dynamic column i want that column to be viewd as rows and their corresponding values infront of them

how can i do it ??
i tried it with pivot but i am able to do it for limited column

othererwise tell me how can i show it on gridview instead of result

推荐答案

这是经常被问到的问题。请按照以下文章:

使用PIVOT和UNPIVOT [ ^ ]

SQL Server中的数据透视表。一个简单的样本 [ ^ ]

T-SQL:多列上的动态数据透视 [ ^ ]

在SQL查询中使用Pivot的简单方法 [ ^ ]

使用Pivot和UnPivot转换 [ ^ ]



下次,请使用 SearchBox [ ^ ]在本网站的右上角。
It's quite often asked question. Please, follow below articles:
Using PIVOT and UNPIVOT[^]
Pivot tables in SQL Server. A simple sample[^]
T-SQL: Dynamic Pivot on Multiple Columns[^]
Simple Way To Use Pivot In SQL Query[^]
Working with Pivot and UnPivot Transformation[^]

Next time, please use SearchBox[^] on the right-top corner of this site.


我没有得到查询,但我试图用c#

解决我的问题我检索数据表中的所有数据并根据我的需要安排这些数据..

谢谢你
I didn't get the query but i tried to solve my problems using c#
I retrieve all the data in datatable and arrange these data as per my need..
Thank You


这篇关于将Sql表列转换为行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆