Regarding ssis - split multi value column into multiple records

Hi,
I have one scenario
Table
Col1. Col2
1. A,b,c,df,ghf
2. C,b
3. B
Output should be
Col1. Col2
1. A
1. B
1. C
1. Df
1. Ghf
2. C
2. B
3. B
please help

Try the below:
Create TVF as below:
CREATE FUNCTION [dbo].[split]
( @String NVARCHAR(4000), @Delimiter NCHAR(1) )
RETURNS TABLE
AS
RETURN
With Split(stpos, endpos)
AS (
SELECT 0 AS stpos, CHARINDEX(@Delimiter, @String) AS endpos
UNION ALL
SELECT endpos + 1, CHARINDEX(@Delimiter, @String, endpos + 1)
FROM Split
WHERE endpos > 0
SELECT 'Id' = ROW_NUMBER() OVER (ORDER BY (SELECT 1)),
'Data' = SUBSTRING(@String, stpos, COALESCE(NULLIF(endpos,0), LEN(@String)+1)-stpos)
FROM Split
Test script:
create Table Test_Table(id int, data varchar(4000))
Insert into Test_Table Values(1,'a,F,c, G'),(2,'LASD,wer,yy')
Select A.id,upper(Left(b.Data,1)) + lower(Right(b.data, Len(b.data) - 1)) From Test_Table A
Cross Apply dbo.split(A.data,',') B
Drop table Test_Table

Similar Messages

  • Regarding ssis - splitting multi value columns in multiple records

    Hi,
    I have table like this
    Sno
    Sname
    1,2
    Sreenivas
    3,4
    Reddy
    5,6
    Raja
    7,8
    Reddy
     I want like the following table
    Sno
    Sname
    1
    Sreenivas
    2
    Sreenivas
    3
    Reddy
    4
    Reddy
    5
    Raja
    6
    Raja
    7
    Reddy
    8
    Reddy

    Hi,
     in source table data having like this
    Eno
    Ename
    Esloc
    Deptno
    1
    Sreenu
    Hyd
    10,20,30,40,50
    I want like this
    Eno
    Ename
    Esloc
    Deptno
    1
    Sreenu
    Hyd
    10
    1
    Sreenu
    Hyd
    20
    1
    Sreenu
    Hyd
    30
    1
    Sreenu
    Hyd
    40
    1
    Sreenu
    Hyd
    50
     How to do this?

  • Split column into multiple text and number columns

    I'm trying to figure out how to split this column into multiple columns with power query. One column for the company name/person name, one for the address, one for the zip.  Some of the addresses have a three or four digit code before the address, which
    I would like in its own column too.  It's the 170 on the lastname, firstname line.  Does anyone have any pointers on this? I'm familiar with PQ advanced editor, but struggling with this one.  
    COMPANY INC. 195 MAIN ST MYCITY ST 12345
    LASTNAME, FIRSTNAME 170 477 ANY STREET CIRCLE  MYCITY ST 12345
    Thanks for your help!

    HI Gil,
    We have column with more than one numbers separated by space or comma or semicolon.
    We need to add the row for each number by keeping all other column value same.
    Here is a original table
    Col1
    Col2
    Col3
    A
    B
    11 22,33 44; 55
    C
    D
    10    20
    and expected output should be
    Col1
    Col2
    Col3
    A
    B
    11
    A
    B
    22
    A
    B
    33
    A
    B
    44
    A
    B
    55
    C
    D
    10
    C
    D
    20
    Please let us know the best way to solve this...

  • How can I separate one column into multiple column?

    How can I separate one column into multiple column?
    This is what I have:
    BUYER_ID ATTRIBUTE_NAME ATTRIBUTE_VALUE
    0001 PHONE_NUMBER 555-555-0001
    0001 EMAIL [email protected]
    0001 CURRENCY USD
    0002 PHONE_NUMBER 555-555-0002
    0002 EMAIL [email protected]
    0002 CURRENCY USD
    0003 PHONE_NUMBER 555-555-0003
    0003 EMAIL [email protected]
    0003 CURRENCY CAD
    This is what I would like to have:
    BUYER_ID PHONE_NUMBER EMAIL CURRENCY
    0001 555-555-0001 [email protected] USD
    0002 555-555-0002 [email protected] USD
    0003 555-555-0003 [email protected] CAD
    Any help would be greatly appreciated.

    This is another solution. Suppose your actual table's name is test(which has the redundant data). create a table like this:
    CREATE TABLE test2 (BUYER_ID number(10),PHONE_NUMBER varchar2(50),EMAIL varchar2(50),CURRENCY varchar2(50));
    then you will type this procedure:
    declare
    phone_number_v varchar2(50);
    EMAIL_v varchar2(50);
    CURRENCY_v varchar2(50);
    cursor my_test is select * from test;
    begin
    for my_test_curs in my_test loop
    select ATTRIBUTE_VALUE INTO phone_number_v from test
    where person_id=my_test_curs.person_id
    and attribute_name ='PHONE_NUMBER';
    select ATTRIBUTE_VALUE INTO EMAIL_v from test
    where person_id=my_test_curs.person_id
    and attribute_name ='EMAIL';
    select ATTRIBUTE_VALUE INTO CURRENCY_v from test
    where person_id=my_test_curs.person_id
    and attribute_name ='CURRENCY';
    INSERT INTO test2
    VALUES (my_test_curs.person_id,phone_number_v,EMAIL_v,CURRENCY_v);
    END LOOP;
    END;
    Then you will create your final table like this:
    create table final_table as select * from test2 where 1=2;
    After that write this code:
    INSERT ALL
    into final_table
    SELECT DISTINCT(BUYER_ID),PHONE_NUMBER,EMAIL,CURRENCY
    FROM TEST2;
    If you have a huge amount of data in your original table this solution may take a long time to do what you need.

  • How to Split Single Outbound Idoc into Multiples

    Hi guys
    Hope you all are doing good.
    Can you please let me know , How to Split Single Outbound IDOC into multiples.
    I am looking for some sought of configuration in IDOC/from SHIPMENT Configuration level.  Because this needs to be implemented for Shipment IDOCS.  Please let me know if this can be done through configurations apart from implementing  User exit or copying the outbound shipment function module.
    Awaiting for your valuable replies.
    Best Regards
    Shiva

    Hello,
    1. Routes
    2. Packaging used
    3. Shipment Type
    Regards
    Waza

  • Split a record into multiple records

    Hi,
    I have situation where i need to split a record into multiple records.
    InputData :
    value|BeginDate |EndDate
    15 |2002/10/15|2002/10/16
    13 |2002/10/13|2002/10/20
    19 |2002/10/19|2002/10/23
    10 |2002/10/10|2002/10/12
    OutPut :
    10 |2002/10/10|2002/10/12
    13 |2002/10/13|2002/10/15
    15 |2002/10/15|2002/10/16
    13 |2002/10/16|2002/10/19
    19 |2002/10/19|2002/10/23
    Thanks

    Hi ,
    As a far I understood from your example ,
    I have few questions...
    1. You have information about the patient in a 1 source table.
    2. how u are identifying for patient X u need 5 rows to be created. R u storing these informations in seprate table or how ...
    3. if you have these information in a seperate tables ..... a simple cross join in ODI should get you the expected result.....
    Or give some more information with a example ..that would be great ...
    Thanks

  • Split XML into multiple records

    Hi All,
    I have to split an XML field from a data type into multiple records on the target side.
    For eg: If the source XML string is something like this:
    <XML_STRING>
    <Data>
       <name>abc</name>
       <place></place>
             <addr1> </addr1>
             <addr2></addr2>
        </place>
       <name>xyz<name>
       <place>
             <addr1></addr1>
             <addr2></addr2>
         </place>
    </Data>
    </XML_STRING>
    Since the above XML string has two records in it (each record includes name and place), I would like to split those two into two separate records in the target structure and send it to ECC.
    How can I achieve this in PI mapping. Here in this case I cannot even differentiate between <> </> to split the messages since a single records might have multiple sub nodes in it. It is only believed that when "<name>" repeats again in the XML that would be a start of new record. Based upon that I need to split the records.
    Thanks in advance!!

    Hi Shweta,
    Minor correction is required for you source structure. Please follow Amit or Vila suggestion for content conversion.
    Did mapping as per your requirement. Please find the screen shot below. Please note the structure and cardinality of the element and node field.
    Hope result is as per your requirement.
    Regards
    Jitender

  • How can I split an Orders05 iDoc into multiple iDocs?

    Hello,
    Can one of you experts please tell me how I can split an ORDERS05 iDoc into multiple iDocs based upon Delivery addresses? 
    For example, if the iDoc contains 3 different Delivery Addresses then I need to split it into 3 iDocs.
    It has been suggested to me that I can Create a custom function module. In this custom fm split the idoc into 3 based on the delivery address and create it using the FM MASTER_IDOC_DISTRIBUTE.
    Problem is I don't know how to do this.  Any help is greatly appreciated.  Thanks.
    Dan

    Hi Dan Avis
    Write a Custom  Z program .
    1 get order05 idoc number....
    2 get the segment details...(Based on you condition...)
    3 In a loop  send the data to the FM MASTER_IDOC_DISTRIBUTE  (Based on you condition...)
    4 IDOC will generated,,,every loop and
    5 Change the status of original idoc .
    or
    Create Function module and use the FM as process code to create 3 idocs...and processs...new generated idoc and block original idocs...
    Call me if you have questions  @ 302 290 5677
    Thanks
    Ramesh

  • I use Exchange to sync my iphone4S with Outlook.  On my iphone, my contacts are split into multiple records if they have more than one email address - how can I consolidate them on the iphone

    i use Exchange to sync my iphone4S with Outlook.  On my iphone, my contacts are split into multiple records if they have more than one email address - how can I consolidate them on the iphone

    I have loaded my Firefox bookmarks into Internet Explorer Favorited. I also uninstalled Safari.
    I go to iTunes on my phone and see no wat to connect my iPhone to my laptop. I see Music, Shows, etc., the kind of stuff I would expect, but no clue as to how to proceed.
    Would you please be so kind to fill me in on how to "That syncing is done via iTunes. Connect the device to iTunes, select it, then go to the Summary page and select to sync bookmarks."?
    I am not sure what you mean by "Summary Page"
    Thank you

  • How Can I Split Multi-Valued Attributes in Syndicator Map?

    Is the option to split multi-values only available for fields and not on attributes that are also multi-valued?

    How Can I Split Multi-Valued Attributes in Syndicator Map?
    Currently this feature are not in MDM you can split this value by using any middleware software for e.g. PI
    Is the option to split multi-values only available for fields and not on attributes that are also multi-valued?
    Correct, Multi-values option only available for field not for attributes
    Thanks,
    Jignesh Patel

  • Split a record into multiple records (rows)

    I am using ODI to move data from source system to target system .Both are Oracle . In the source system I have a record which I need to split into multiple records or rows in the target system based on some rules . How can I achieve this in ODI . Please explain

    Hi ,
    As a far I understood from your example ,
    I have few questions...
    1. You have information about the patient in a 1 source table.
    2. how u are identifying for patient X u need 5 rows to be created. R u storing these informations in seprate table or how ...
    3. if you have these information in a seperate tables ..... a simple cross join in ODI should get you the expected result.....
    Or give some more information with a example ..that would be great ...
    Thanks

  • Split TempDB Data file into multiple files

    Hey , 
    I have been seeing TempDB contention in memory on our SQL server 2012 Enterprise Edition with SP2 and I need to split TempDB Data file into multiple files .
    Could someone please help me to verify the following information:
    1]
    We are on SQL server 2012 Enterprise Edition with service pack2 but as per SQL Server 2012 Enterprise Edition under CAL Licensing –We are limited to use 20 logical processors instead 40 logical processors. Our SQL is configured
    on NUMA nodes and with the limitation SQL uses only 2 NUMA nodes on live .There are 10 logical CPUs are evenly assigned to each NUMA nodes. Microsoft recommends that if SQL server configured on NUMA node and we have 2 NUMA nodes, then we may add two data files
    at a time. Please let me know should I add two TempDB data file at a time?
    2] We have TempDB Data and log files both on the same Drive of SQL server  .When I split TempDB into two Data files, I can get them on the same Drive .What your recommendation should I need to create TempDB Data files on the same drive or on separate
    disks?
    3] What would be the blackout plan for splitting the tempdb into multiple files? Please let me know if someone has a better back out plan ?
                1] Run script that create tempdb Database with a single file
    2] Reboot SQL service in order to apply change   
    Your help will be apprecited .
    Thanks ,
    Daizy

    Tom , I am seeing TempDB contention on Production server when there is a heavily load on sql server . We also experiencing the overall system slowness.Please look at Pagelatch wait statistics on our server ,Please advise .
    wait_type
    waiting_tasks_count
    wait_time_ms
    max_wait_time_ms
    signal_wait_time_ms
    PAGELATCH_UP
    2680948
    3609142
    10500
    508214
    PAGELATCH_SH
    1142213
    1338451
    8609
    324538
    PAGELATCH_NL
    0
    0
    0
    0
    PAGELATCH_KP
    0
    0
    0
    0
    PAGELATCH_EX
    44852435
    7798192
    9886
    6108374
    PAGELATCH_DT
    0
    0
    0
    0
    Thanks ,
    Daizy

  • Insert Insert XML file into multiple records in Oracle Database

    I would like to find out if it is possible to insert a single XML file into multiple records or tuples in a Oracle database table. I have a single XML file which is at multiple levels. The meta data for the levels are common and each level can have meta data of their own in addition. I do not have any meta data field which will uniquely determine whether the data belongs to Root level, Intermediate level or at the document level. Is there any way I can determine which level the meta data belongs to and thereby make a corresponding entry into the database table tuple? For example I could have an attribute called level which is going to be present only in the database table and not in the XML file. If level=1 then it corresponds to "Root" meta data, if level=2 then it corresponds to "Intermediate" level and if level=3 then it corresponds to meta data at document level. I need a way to calculate the value for level from the XML file and thereby insert the meta data element into a tuple in a single table in Oracle.

    Hi,
    extract your xml and then you can use insert all clause.
    here's very small example on 10.2.0.1.0
    SQL> create table table1(id number,val varchar2(10));
    Table created.
    SQL> create table table2(id number,val varchar2(10));
    Table created.
    SQL> insert all
      2  into table1 values(id,val)
      3  into table2 values(id2,val2)
      4  select extractValue(x.col,'/a/id1') id
      5        ,extractValue(x.col,'/a/value') val
      6        ,extractValue(x.col,'/a/value2') val2
      7        ,extractValue(x.col,'/a/id2') id2
      8  from (select xmltype('<a><id1>1</id1><value>a</value><id2>2</id2><value2>b</value2></a>') col from dual) x;
    2 rows created.
    SQL> select * from table1;
            ID VAL                                                                 
             1 a                                                                   
    SQL> select * from table2;
            ID VAL                                                                 
             2 b                                                                    Ants

  • Tag an UCM document into multiple records

    What is the best way to tag a document into multiple records in UCM 11g ? In my webcenter application , a builder having site with many plots (say 100) wants a document in UCM to be tagged against some selective plots(say 1-10). He can again change the tagging (ie. he can add more plots or remove the tag from existing etc) . Each home owner will have either one or more plots . When the home owner logs in, he should be able to see that document which is tagged against that plot.
    Thanks ....

    Hi wilsonea,
    You're probably thinking of InDesign's Data Merge function.  Here are two links that may help you decide if this is what you're thinking of doing:
    InDesign Help | Data merge
    How to data merge in InDesign tutorial - YouTube
    If this is what you're thinking of, you'll need the design laid out in InDesign and a CSV file.  The above YouTube video provides a decent instructions on this.
    When you save your Excel file as a CSV file, I recommend that you also save it as a XLS (not XLSX) file too.  The CSV file will not save any formatting (like column widths and cell formatting), which makes it difficult to read the cell content whenever I have to use the file often.
    Hope this helps.  Cheers!

  • How to split list of columns into 2 tables in SSIS 2012?

    Hi,
    I have 200 columns in Source. Now i want to split these columns, few into Destination A and few more columns into
    Destination B. Multi cast i tried to use, but it coping all the columns . Any help would be appreciated. Thanks in Advance.
    Lets assume  i have columns  A,B,C,D,E..
    i want to move Columns A,B,D into destination A and 
    columns A,C,D,E INTO Destination B. please help me to implement this logic?

    Hi vasu_479,
    Based on your description, you want to split columns in source table into two destination tables.
    After testing the scenario in my environment, we can use Multicast to achieve your requirement. Just as you said, the Multicast would return all columns. But we can use the method below to achieve the goal:
    If the destination tables are existing tables, we can just map column A, B and D as Input Columns to the corresponding Destination Columns in the Mapping tab for destination A. Then map column A, C, D and E in destination B.
    If the destination tables are created in the Destination component, we can modify the create table query to directly create A, B and D for destination table A, create A, C, D and E for destination table B. Then there columns would be automatically mapped
    in the Mappings pane.
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

Maybe you are looking for

  • Printing from Adobe Photoshop CS5 on a HP Color Laserjet CP5225 printer

    Hi When I want to print something out from Photoshop CS5 on my printer I get this error. PCL XL Error Subsystem: KERNEL Error: IllegalOperatorSequence File name: derived_scr/1x55.ndbg.kernel.c Line number: 1820 My windows system is Windows xp proffes

  • Service tax calculation

    hi releasing to accounting document in vf02 transaction code   error showing  eRROR IN ACCOUNT DETERMINATION table T030k key MCA ZWS, but i created zws account key and i assinged proper account . any body give me mail id i will send full screen shots

  • HT1151 Cannot retrieve file after I forgot to properly eject the USB it was on--what can I do to get this file to open?

    Cannot retrieve file after I forgot to properly eject the USB it was on--what can I do to get this file to open?  Thanks for helping me out b/c it would take days to re-create this file!  IMAC 10.5.8 Excel File using .xls extension.

  • Detect SAP client

    Dear sirs, I hope you can help me with this: I have few reports with output into MS Word using ABAP OLE. That works just fine with SAP GUI. The problem is the number of my users work with the web GUI. When using web GUI I cannot work with OLE (at lea

  • Error - SAP SOL 4.0 Installation - SLES9 - MaxDB | Error Number JS-30151

    Hi Guys, i got an Error if I want to install the Solution Manager 4: JS-30151 Java Process Server0 of Instance SM4/DVEBMGS01 [ABAP: Active, Java: (Dispatcher; RUNNING, server0: UNKNOWN)] did not start after 18:00 minutes. Giving up. FC0-00011 The ste