Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
pras2007
Posting Yak Master
216 Posts |
Posted - 2009-06-04 : 07:56:47
|
| Hello All,I’m trying to construct a table that would store detailed results into one field value, can this be done? The problem is that I can have a detailed value that has “x” amount of columns and “y” amount of records. I want that record set stored in one field, is it possible?For Example:ID COL1 COL2 COL3 ….1 Sue Smith HR2 Mike Bolton Finance3 Matt Haggar Billing….The example above should have a unique ID and all the record set stored in one fieldUnique_ID Value(Unique ID to identify the record set) (Information from the record set, stored in one field)Please advice.Thanks. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-06-04 : 08:38:11
|
| Tryselect ID, COL1 from your_tableunion allselect ID, COL2 from your_tableunion allselect ID, COL3 from your_tableMadhivananFailing to plan is Planning to fail |
 |
|
|
pras2007
Posting Yak Master
216 Posts |
Posted - 2009-06-04 : 10:29:58
|
| Thanks for the response, but what I’m looking to do is to store a recordset into 1 field with 1 Unique_ID to relate the recordset., maybe an array would do the trick. Storing the recordset into an array… I’m not sure if I’m being clear on my requirements. Please let me know Thanks. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-06-04 : 12:58:09
|
| there's no concept of array in sql. are you trying to building a comma seperated string from each record value of table? |
 |
|
|
pras2007
Posting Yak Master
216 Posts |
Posted - 2009-06-07 : 13:51:48
|
| Sorry for the slow response visakh16, the answer is yes, how can I build a comma seperated string of the record set and insert the value into a single column. Please advice. Thanks. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-06-07 : 13:58:34
|
Can I ask you why you want to do that?It really hurts to see what happens to a relational database sometimes... No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-06-07 : 13:59:30
|
| see the below link. there are few methods discussed therehttp://www.projectdmx.com/tsql/rowconcatenate.aspx |
 |
|
|
pras2007
Posting Yak Master
216 Posts |
Posted - 2009-06-07 : 15:32:41
|
| Thanks for the response visakh16, I will take a look at the link you provided. webfred, The reason I want to do it like this is because it would allow me to use one structure for all type of result record set regardless on the number of columns. Thanks |
 |
|
|
|
|
|
|
|