I found the articles and discussion interesting.
I have built a web based content management system where the page content is stored in XML representation in one field.
I did this because it is easy to change the data structure as needed, and each row can have a different XML structure if necessary.
The down sides to this are:
What I would prefer to do is to have each structure stored in its own table, with markup elements one per field.
However, when reading the data out for display this would require something like:
select @table from pages where pageid = @pageid
select * from @table where pageid = @pageid
As far as I can tell, the solution advocated in these articles would go something like:
select @table from pages where pageid = @pageid
if @table = 'structure1'
begin
select * from structure1 where pageid = @pageid
end
if @table = 'structure2'
begin
select * from structure2 where pageid = @pageid
end
etc.
This is certainly harder to maintain than the dynamic SQL alternative.
Is there a better way, or is dynamic SQL a 'satisfactory' approach?
BTW I already have to use dynamic SQL for our distributed queries on to Oracle!