advanced query – help needed | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

advanced query – help needed

I need a rather advanced query that transforms data from a table to a specified format. I am providing a screenshot of the initial and desired formats. Oh, and there are several thousands of records here, so any cursors enumerating over 100 times cannot be used due to performance. Original table: Original table.png Desired result: Desired result.png
Note that ‘characteristic x name’ is not the same for each item, as the number of characteristics can be different per each item. The order of characteristics is not important, but if an item has 3 characteristics, they must occupy spots 1 through 3. Myself I was only able to do it with cursors (slow), my colleague did it with clr/.net (not recommended). Many thanks in advance.
Seriously this doesn’t seem to be a task for the database engine. It should rather be handled at the presentation layer. It can be done in T-SQL with dynamic SQL and pivoting, but it be better not.
]]>

Software Reviews | Book Reviews | FAQs | Tips | Articles | Performance Tuning | Audit | BI | Clustering | Developer | Reporting | DBA | ASP.NET Ado | Views tips | | Developer FAQs | Replication Tips | OS Tips | Misc Tips | Index Tuning Tips | Hints Tips | High Availability Tips | Hardware Tips | ETL Tips | Components Tips | Configuration Tips | App Dev Tips | OLAP Tips | Admin Tips | Software Reviews | Error | Clustering FAQs | Performance Tuning FAQs | DBA FAQs |