Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to pivot this 2 tables?
Message
From
19/09/2015 13:05:39
 
 
To
19/09/2015 12:55:19
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2014
Application:
Web
Miscellaneous
Thread ID:
01624819
Message ID:
01624822
Views:
51
>>John, I can give you a code sample, but I do have a question.
>
>>Are those column definitions fixed ( quotes, declined at beginning, not ended, no credit card), or could you have other reasons that equate to >columns as well?
>
>The definitions came from another query and those will change in different time/client, so it cannot be like: "for colsdef in ([declinet at beginning], [not ended], etc..."

OK. One other question - are you trying to produce this query for a report in Reporting Services? Or will the output be used by something other than SSRS?

Reason I ask....SSRS has a very nice dynamic pivot capability (the SSRS matrix) where you don't need to specify the columns names.

By contrast, the regular SQL PIVOT (or even CASE statements to build columns) requires that you "spell out" the column names. If the names of columns is dynamic and could change over time, you'd have to use dynamic SQL. Certainly not horrible, but it does add a level of complexity.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform