Monday, 24 January 2022

String Split in SQL

 Hi All,

We had a requirement where we had to seperate comma seperated values and unpivot it 

i,e if the column is Valid,Input, Outcome then expected results are 

1. Valid

2. Input

3. Outcome


To acheive this, I used the below query 

Insert Into Claims_Detail
SELECT ClaimsID, splitC.Value
From [pce].[Claims_Dim]
CROSS APPLY STRING_SPLIT([pce].[Claims_Dim].ProductPositionClaimsName,',') splitC


Bingo..Issue fixed.



No comments:

Post a Comment