I have .csv
file have two columns
Main Category Sub Category
--------------------------------------------------------
Technology/Internet Computers/Internet,Technology/Internet,Software Downloads, Social media
I'd like to make these two columns like that
Main Category Sub Category
--------------------------------------------------------
Technology/Internet Computers/Internet
Technology/Internet Technology/Internet
Technology/Internet Software Downloads
Technology/Internet Social media
I tried to use this expression:
SUBSTRING(Sub Category,1,FINDSTRING(Sub Category,"-",1) + 1,LEN(Sub Category))
in derived column
in SSIS
but it dose not work
and, can I put while loop
like that in SSIS
Declare
@start int,
@end int,
@category_group Varchar(250),
@sub_category varchar(250)
set @start = 1
set @end = 99
set @category_group =(select distinct([Sub_Category]) from [Site_Categories])
set @sub_category =
(select replace(substring([Sub_Category],1,charindex(N',',[Sub_Category],1)),',','') from [Site_Categories])
while
@start <= @end
begin
insert into [dbo].[Category_group]
([category_group],[sub_category])
select
@category_group,
@sub_category
set @start= @start+1
end
please what I should do to fix this Case in SSIS