Pivot query result (column name will change)

RJ 166 Reputation points
2024-10-02T23:08:15.1166667+00:00

Hi there,

Have been working on a huge database task and one part of it is the below.

How do i pivot this 1 row with dynamic columns (column names will change)

Query:

select top 1 * from INFORMATION_SCHEMA.columns

Output should be

ColumnName | Value

Thanks.

Azure SQL Database
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,770 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,637 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.