During this time there are programming, dynamic SQL statements involving the MS SQL.
The original data table, a lot of data, need to have data records to be counted, and need to be displayed, that is, row and column conversion. Data is displayed, which means that the final column is dynamically changing. Data is not displayed.
Put all the data in a temporary table, simply convert the column name data.
Then, based on this temporal table, we handle dynamic SQL statements with select columns, declaring variables, assigning variables, and updating them.
The above lines, at run time, get the results and format as follows, with different column names for the data:
Next, you can see that insus.net in the dynamic to reference these variables, the Execute method executes a multi-line SQL statement at once.
Dynamic columns summarize data from one table to another table