goofaholix
MIS
I have a complex data structure which I've simplified into a View which looks something like this (This is very simplified, I have over 400 ColumnNames);
UID ColumnName DateValue StringValue IntValue TextValue
1234 StartDate 30/04/2008
1234 Name Jim Bloggs
1234 Age 30
1234 Description blah blah
I've created a table to receive the data which will look something like this when the data is added;
UID StartDate Name Age Description
1234 30/04/2008 Jim Bloggs 30 Blah Blah
I've experimented with using the Pivot function and it will work for all datatypes except the Text columns.
I've tried rolling up DateValue, StringValue, IntValue TextValue into one column before I pivot but I have to convert the data types to varchar and the Text column ends up being truncated.
I tried doing a dynamic pivot in a stored procedure when the query is run but I need to view the field list in Reporting Services and Reporting Services doesn't automatically create these when the columns are dynamic. Mnaually creating hundreds of fields in each report isn't an option.
Is there any other way?
I wondered if a dynamic update statement was possible. Something like;
Update table set column = textvalue
where column = columnname and UID = UID
It would need to be dynamic as I don't want to hard code 100+ of these for each ciolumn that has a datatype of Text.
Thanks
bruce
UID ColumnName DateValue StringValue IntValue TextValue
1234 StartDate 30/04/2008
1234 Name Jim Bloggs
1234 Age 30
1234 Description blah blah
I've created a table to receive the data which will look something like this when the data is added;
UID StartDate Name Age Description
1234 30/04/2008 Jim Bloggs 30 Blah Blah
I've experimented with using the Pivot function and it will work for all datatypes except the Text columns.
I've tried rolling up DateValue, StringValue, IntValue TextValue into one column before I pivot but I have to convert the data types to varchar and the Text column ends up being truncated.
I tried doing a dynamic pivot in a stored procedure when the query is run but I need to view the field list in Reporting Services and Reporting Services doesn't automatically create these when the columns are dynamic. Mnaually creating hundreds of fields in each report isn't an option.
Is there any other way?
I wondered if a dynamic update statement was possible. Something like;
Update table set column = textvalue
where column = columnname and UID = UID
It would need to be dynamic as I don't want to hard code 100+ of these for each ciolumn that has a datatype of Text.
Thanks
bruce