Given strings:

```
string 1: 'A,B,C,D,E'
string 2: 'X091,X089,X051,X043,X023'

```

Want to store into the temp table as:

```
String1     String2
---------------------
A           X091
B           X089
C           X051
D           X043
E           X023

```

**Tried**: Created user defined function named `udf_split` and inserting into table for each column.

```
DECLARE @Str1 VARCHAR(MAX) = 'A,B,C,D,E'
DECLARE @Str2 VARCHAR(MAX) = 'X091,X089,X051,X043,X023'

IF OBJECT_ID('tempdb..#TestString') IS NOT NULL DROP TABLE #TestString;

CREATE TABLE #TestString (string1 varchar(100),string2 varchar(100));

INSERT INTO #TestString(string1) SELECT Item FROM udf_split(@Str1,',');
INSERT INTO #TestString(string2) SELECT Item FROM udf_split(@Str2,',');

```

But getting following result:

```
SELECT * FROM #TestString

string1 string2
-----------------
A       NULL
B       NULL
C       NULL
D       NULL
E       NULL
NULL    X091
NULL    X089
NULL    X051
NULL    X043
NULL    X023    

```