0

I have a Information Table which has values

Code Question    Score
BU   1,2,3,4     10
BI   2,3,4,5,6,7  6

Output

Code Question Score
BU   1        10
BU   2        10
BU   3        10
BU   4        10
BU   5        10
BI   2        6
BI   3        6
BI   4        6
BI   5        6
BI   6        6
BI   7        6

I am not not able get the output in the right format but request you to please suggest is it the write way to do because in the real time scenario the data can be in millions

Mikael Eriksson
  • 136,425
  • 22
  • 210
  • 281
  • 2
    [STRING_SPLIT (Transact-SQL)](https://learn.microsoft.com/en-us/sql/t-sql/functions/string-split-transact-sql?view=sql-server-ver16) – Mikael Eriksson Aug 01 '23 at 11:14
  • It is highly unlikely that storing data like that is the "right" way. What type of column is `Question` and how big is it? What if there is one more question that the number you have allowed for? – CHill60 Aug 01 '23 at 11:49
  • Select * from yourtable t cross apply string_split(t.question, ',') x – siggemannen Aug 01 '23 at 11:49

0 Answers0