[Solved] I want to fetch data from table and append column name code to the value as key value pair. How to achieve this in SQL?

[ad_1]

You can achieve it like following.

SELECT '8=' + CAST([8_length] AS VARCHAR(10)) AS [8_length]
FROM [Your_Table]

Note: If the column type is already VARCHAR, in that case you don’t need to use CAST

[ad_2]

solved I want to fetch data from table and append column name code to the value as key value pair. How to achieve this in SQL?