In SQL Server 2008, I have the following tables:
CREATE TABLE samples (SampleID int, Time datetime, RawData image)
CREATE TABLE parameters (ParamID, SampleID int, ParamType uniqueidentifier, Value float)
In this scenario my application processes a given sample (from ‘samples’ table) and extracts several diferent parameters and stores them on the ‘paremeters’ table.
I would like to create a temporary table where every parameter (defined by a specific ParamType) is a column and every row is defined the values of every parameters extracted from every given sample. The problem is that the number and name of the columns of the result are dependent on the values of the ‘parameters’ table.
How can this be done?
I am not exactly sure what you are asking, but this should be close to what you want:
Here it is running on SEDE.