I want to split the given comma separated string into columns.
I have a table with two columns:
Example:
create table t3
(
cola varchar,
colb varchar
);
Insertion:
insert into t3 values('AD1','2000-01-01to2000-02-01'),
('AD2','2000-03-01to2000-04-01'),
('AD3','2000-05-01to2000-06-01');
Now I want prepare two comma separated strings from the given above records to like this:
str1 varchar = 'AD1,AD2,AD3';
str2 varchar = '2000-01-01to2000-02-01,2000-03-01to2000-04-01,2000-05-01to2000-06-01';
Now I want to store the comma separated string and in second string there is to for separation into two dates, want to store into the temp table.
Like this:
Expected Output:
c1 c2 c3
---------------------------------
AD1 2000-01-01 2000-02-01
AD2 2000-03-01 2000-04-01
AD3 2000-05-01 2000-06-01