question

Nilkanthn avatar image
Nilkanthn asked

Is it possible to map row value of one table to column header of another table without dynamic query?

I have one table with column headers in rows and another table with those values as column names. Every time i need to run dynamic query with pivot to get result. Can you please help?

Table 1: TempColumn

Project_IdTempColumn18Temp223Temp425Temp35142Temp6


Table 2: Order_Data

Project_IdTemp1Temp2Temp3Temp41818-Order_Number_101-Jan-2021Test DataTest Data1818-Order_Number_202-Jan-2021Test DataTest Data1818-Order_Number_303-Jan-2021Test DataTest Data2323-Order_Number_3302-Jan-2021Test DataTest Data14223-Order_Number_33215-Jan-2021Test DataTest Data


Now i want to map TemColumn from Table 1 with column header of Table 2. (For Ex: I am looking to get data for selected date range and for that i need to map TempColumn with column header of table 2). I don't want to use dynamic query as it is actually time consuming as data present in second have large number of data.

sql-server-2016
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

· Write an Answer

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.