Friday, February 24, 2012

Dynamic table creation

Suppose I have a table named table1 which has a field question_Id.There are many values for this field say 100,101,102.
Now I want to make a table with the field name 100,101,102 but the problem is that it is not fixed how many values are there for question_id.Here in this example I mentioned three(100,101,102) but it may be anything.How can I make a table with the field names this way?
SubhasishOriginally posted by subhasishray
Suppose I have a table named table1 which has a field question_Id.There are many values for this field say 100,101,102.
Now I want to make a table with the field name 100,101,102 but the problem is that it is not fixed how many values are there for question_id.Here in this example I mentioned three(100,101,102) but it may be anything.How can I make a table with the field names this way?
Subhasish

Why do you want to do this?
Looks like you're after some kind of crosstab report, right?|||Yes Frank I need that.How to do?|||Two of the better solutions to this can be found here
http://www.winnetmag.com/SQLServer/Article/ArticleID/15608/15608.html
or
http://www.sqlteam.com/item.asp?ItemID=2955

Btw, personally I think this thing should strictly be done at the client as this is more of data presentation.

HTH

No comments:

Post a Comment