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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How do i save collections in SQL? {NOT RESOLVED}

Author  Topic 

petre
Starting Member

11 Posts

Posted - 2010-09-30 : 04:42:41
hi friends,

in my previouse post, i have asked how to split csv with mutple columsn and rows and returna table ... but i dont think the thread is clear enough to understand the situation:
the image contain the relationship between Question, QuestionAnswers and Answer entities,


When i save a question along with i have save N number of answers and whne save a question i have to save data to two other tables, ANswers and QuestionAnswers
So with the question i pass a colleciton of answers thsi collection will be sent to the sp as a csv, so my collection would like this:

q_text - 'which numbers make 4?'

Answers collection:
'1, 1', f, 1
'2, 2', t, 1
'1, 2', f, 1
'3, 2', t, 1

PS: second and third values in a row, is the is_corrent and is_active for the table QuestionAnswers also note that the first value IS IN single quotes.

so i do i extract these csv values to save in a ANswers and QuestionAnswers along with Questions?

thanks

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2010-09-30 : 08:00:13
if PK of QA table is g_idx, then a question can only have one answer. Think you need a compound key there.


elsasoft.org
Go to Top of Page

petre
Starting Member

11 Posts

Posted - 2010-09-30 : 08:30:24
quote:
Originally posted by jezemine

if PK of QA table is g_idx, then a question can only have one answer. Think you need a compound key there.


elsasoft.org



i could make the compound key as q_idx and a_idx then still it doesnt solve my problem : )
Go to Top of Page
   

- Advertisement -