Splitting Comma separated values in columns to multiple rows in Sql Server -


There are three columns in my table, one of the columns [ Col3 ] has multiple values, therefore, When I make a specific order on the table:

  call 1 with my call, cola 2, select colle 3   

this gives me the following results :

  Col1 Col2 Col3 ------------------------------ Line 1 430 A319 N1160 N1336 If there is a way to get the output:  
  Col1 Col2 Col3 -------- ---- ------------------ Line 1 430a 319 Columns such as N-1160 line 2 430A319N336 line 3 ABC FEG G3489 Row 4 ABCEFF M 5678 RO 5 ABC NFEF N 5643   

, then in columns A new line is displayed according to each value and the other column should have duplicated data.

I hope I am very clear from the problem.

  select col1, col2, split.a.value ('.', 'Varchar ( 100) 'from 3 to (SELECT col1, col2, cast (' & lt; m & gt; '+ Change (col3,' ','  & lt; m & gt; ') + '& Lt; / m & gt; AS XML] from the data [table]] as a cross application data. Node (' / m ') es split (a)    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -