How convert each row of table to as columns in sql server
hi,
I want convert entire row in table as single column , example is show below
QuteNo || requestNo || cat1 || cat2 || cat3
------------------------------------------------------------------------------------
01 1 a b c
2 1 d e f
3 2 g k l
Expected Result :
heading 01 2 3
requestno 1 1 2
cat1 a d g
cat2 b e k
cat3 c f i
Microsoft SQL Server
Last Comment
Vitor Montalvão
8/22/2022 - Mon
Vitor Montalvão
You'll need to use PIVOT but usually you'll need to know the field values otherwise you'll need to do it dynamically that it's more complex.
codeoxygen
ASKER
Vitor sir i used it but it shows error so please how to use it can u explain
Vitor Montalvão
Can you post your actual query and the error returned?
You query returns error: Msg 207, Level 16, State 1, Line 73
Invalid column name 'Insuranceprovider'.
Msg 207, Level 16, State 1, Line 74
Invalid column name 'Insurancetype'.