SQL Update to split 1 column into 2

I have a column in a table that holds both a city and a zip ex. Jackson 44319
I am trying to write an sql update query so that the 2 pieces of info would be split and funneled into their own respective column. For example:
Before
column name: address
Jackson 44319
After
column name:city                             column name: zip
Jackson                                           44319
Here is what I have come up with so far, but it does not work correctly.
Update Table
Set city=Parsename(Replace(address ,',','.'),2),
zip=Parsename(Replace(address ,',','.'),1)
this query basically copies all my info from the address table and puts it into the zip table, and the city table remains null. yet, nothing gets split.

Does your db have a bulk loading utility?  Do you have access to text manipulation tools such as awk?
If so, using them is probably a better idea than using ColdFusion.

Similar Messages

  • Splitting one column into different columns.

    Hello Experts,
    How do i split datetime column into different columns while doing a Select statement.
    Ex:
    The column "REC_CRT_TS" has data like "2014-05-08 08:23:09.0000000".The datatype of this column is "DateTime". And i want it in SELECT statement like;
    SELECT
    YEAR(DATETIME) YEAR,
    MONTH(DATETIME) MONTH,
    DATENAME(DATETIME) MONTHNAME,
    DATEPART(DATETIME) WEEKNUM,
    DAY(DATETIME) DATE,
    DATEPART(DATETIME) HOUR
    FROM TABLE_NAME;
    The output should look like this;
    --YEAR| MONTH | MONTHNAME| WEEKNUM | DATE | HOUR
    --2014| 5 | May | 25 | 08 |08
    Any suggestions please.
    Thanks!
    Rahman

    I made a very quick research and I see in this blog post
    http://www.jamesserra.com/archive/2011/08/microsoft-sql-server-parallel-data-warehouse-pdw-explained/
    that  It also uses its own query engine and not all features of SQL
    Server are supported.  So, you might not be able to use all your DBA tricks.  And you wouldn’t want to build a solution against SQL Server and then just hope to upsize it to Parallel Data Warehouse Edition.
    So, it is quite possible that this function doesn't exist in PDW version of SQL
    Server. In this case you may want to implement case based month name or do it in the client application.
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • Splitting one column into 4 columns

    Hi,
      I want to split one column into 4 columns as shown below.
    parameters
    PanelPanel=MP01110201&YearYear=2013&Source=1&UserID=aad2779
    PanelPanel=MP12100173&YearYear=2013&Source=1&UserID=aac6440
    it should be display as 
    panel                      yearyear                source              userid
    MP01110201           2013                            1                    aad2779
    MP12100173           2013                            1                    aac6440
    there will be thousands of rows in the column. Can anybody help how to split it as shown.The length may very from row to row
    Thanks for your help.........
    BALUSUSRIHARSHA

    It is working...thank u very much... I found one more issue here
    PanelPanel=MP01110201&YearYear=2013&Source=1&UserID=aad2779
    PanelPanel=MP11100070&Source=1&PNR=2&YearYear=2014&UserID=ddc1535
    PanelPanel=MP11101276&Source=1&YearYear=2014&PNR=2&UserID=ddc1565
    I found 3 kinds of formats in the same column... I didn't observe the data carefully while posting the
    question..sorry about that. In this case if we need to show as
    panel                      yearyear                source
                 userid
    MP01110201           2013                            1                    aad2779
    MP11100070           2014                           1                    ddc1535
    MP11101276           2014                
              1                    ddc1565
    is it possible to filter like this? Should we use any case statement in query while we have diff formats
    like this?
    BALUSUSRIHARSHA

  • Split 1 column into multiple columns

    Hi
    How can we acheive this in Sql:
    Col 1
    abc def ghi jkl
    convert to:
    Col 1
    Col 2
    Col 3
    Col 4
    abc
    def
    ghi
    jkl
    Royal Thomas

    The best approach is to NOT split them out into individual columns... It violates the 1st normal form...
    Under first normal form, all occurrences of a record[sic] type must contain the same number of fields[sic].
    First normal form excludes variable repeating fields[sic] and groups.
    The better approach is to split them into rows, in their own table, with a foreign key reference back to the table you are pulling them away from.
    If you check my 1st post you'll see that I split the string with a function. That same a function can be used to populate the new table.
    Something along these lines...
    IF OBJECT_ID('tempdb..#BadOldDesign') IS NOT NULL
    DROP TABLE #BadOldDesign;
    CREATE TABLE #BadOldDesign (
    ID INT NOT NULL IDENTITY(1,1) PRIMARY KEY,
    ListOfCodes VARCHAR(100) NOT NULL
    INSERT #BadOldDesign (ListOfCodes) VALUES
    ('abc htr tbj yfd hjk mth'),
    ('bbb hyt tbj vyk hjk htd'),
    ('vvv nud'),
    ('yyy hyn tbj bdr '),
    ('htr htf tbj yfd hjk mko'),
    ('kio bhn tbj bjd hjk'),
    ('byd loj tbj yfd hjk cds');
    SELECT * FROM #BadOldDesign bod
    IF OBJECT_ID('tempdb..#ShinyNewTable') IS NOT NULL
    DROP TABLE #ShinyNewTable;
    SELECT
    bod.ID,
    sc8.ItemNumber,
    sc8.Item
    INTO #ShinyNewTable
    FROM
    #BadOldDesign bod
    CROSS APPLY dbo.SplitCSVToTable8K(bod.ListOfCodes, ' ') sc8;
    ALTER TABLE #ShinyNewTable ALTER COLUMN id INT NOT NULL;
    GO
    ALTER TABLE #ShinyNewTable ALTER COLUMN ItemNumber INT NOT NULL;
    GO
    ALTER TABLE #ShinyNewTable ADD CONSTRAINT pk_ShinyNewTable PRIMARY KEY CLUSTERED (ID, ItemNumber);
    SELECT * FROM #ShinyNewTable snt
    The dbo.SplitCSVToTable8K function that I'm using can be found here... http://www.sqlservercentral.com/articles/Tally+Table/72993/
    HTH,
    Jason
    Jason Long

  • Split multiple columns into rows using XML

    Hi Forum,
    I am trying to split 2 columns that each contain values separated by semicolon into single rows. The relation between the values of the two columns is that the order in the cells corresponds to each other.
    The data looks like this:
    pk    Manufacturer                partnumber
    1     Man1; Man2;Man3      PN1;PN2;PN3
    2     Man4; Man2;Man5      PN4;PN5;PN6
    The result should be:
    pk    Manufacturer     partnumber
    1       Man1                   PN1
    1       Man2                   PN2
    1       Man3                   PN3
    2       Man4                   PN4
    2       Man2                   PN5
    2       Man5                   PN6
    I am not sure how to format the XML to get a useful Basis for XML.value or XML.query
    Any ideas?
    TIA
    Alex

    Hi,
    Try like this ,
    DECLARE @tmp TABLE (pk INT,Manufacturer NVARCHAR(50),partnumber NVARCHAR(50))
    INSERT @tmp SELECT 1,'Man1; Man2;Man3','PN1;PN2;PN3'
    INSERT @tmp SELECT 2,'Man4; Man2;Man5','PN4;PN5;PN6'
    SELECT * FROM @tmp
    SELECT tmp2.pk pk,Manufacturer,partnumber FROM (
    SELECT ROW_NUMBER()OVER(ORDER BY tmp1.pk) RN,* FROM (
    SELECT pk,
    LTRIM(i.value('.','varchar(100)')) Manufacturer
    FROM ( SELECT pk, Manufacturer,
    CONVERT(XML,'<r><n>'
    + REPLACE(Manufacturer,';', '</n><n>') + '</n></r>') AS X
    FROM @Tmp) Spt
    CROSS APPLY Spt.X.nodes('//*[text()]') x(i)
    ) tmp1 ) tmp2
    JOIN
    (SELECT ROW_NUMBER()OVER(ORDER BY pk) RN,* FROM (
    SELECT pk,
    j.value('.','varchar(100)') partnumber
    FROM ( SELECT pk, partnumber,
    CONVERT(XML,'<r><n>'
    + REPLACE(partnumber,';', '</n><n>') + '</n></r>') AS Y
    FROM @Tmp) Spt
    CROSS APPLY Spt.Y.nodes('//*[text()]') y(j)) tmp2 ) tmp3 ON tmp3.RN = tmp2.RN
    sathya - www.allaboutmssql.com ** Mark as answered if my post solved your problem and Vote as helpful if my post was useful **.

  • Splitting of column into furthur subcolumn's into an ALV list

    Hi All,
      I've to display the data in a alv grid in Such format.
    category
    name
    age
    |--|-|
    sc
    st
    As far as i know there is no way available  to split the column headinng furthur into subheadings.
      But any how if it is possible please tell me.
      Note : The above displayed list is just an eaxmple there may be dynamically furthur subdivision of it's heading.
    --Amit

    Amit,
    Its not possible to merge neither the headings nor the columns as such.
    Regards,
    Ravi

  • Split single column into multiple column using sql /plsql

    create table test (name varchar2(255);
    insert into test values('DH  RED 20 12/10 10 2 ');
    insert into test values('PM  STUD 20 15/10 20 29.55' );
    insert into test values('LS  MENTHOl FILTER ASC 18/70 60 240.66');
    insert into test values('WINSTON WHITE CLASSIC 13    18/70 60 240.66');
    My Output should be like as below in other table :
    create table test_result (brand varchar2(255),packet   varchar2(50),amount varchar2(25),total varchar2(25));
    BRAND                                   PACKET       AMOUNT           TOTAL
    DH  RED 20                            12/10            10              2
    PM  STUD 20                           15/10            20              29.55
    LS  MENTHOl FILTER ASC               18/70            60              240.66
    WINSTON WHITE CLASSIC 13             18/70            60              240.66can you please help me to solve this issue
    thanks in advance
    Edited by: A on Apr 21, 2012 11:33 PM
    Edited by: A on Apr 21, 2012 11:34 PM
    Edited by: A on Apr 21, 2012 11:34 PM

    h4. # Database should be 10g. If version is below 10g query need to be modified as per string format.
    h4. # Split string into two parts by '/'. First part contain brand + packet(1), Second part contain packet(2) + amount + total
    h4. # Your brand name can be of any length.
    String Format* : <Brand Name><space><packet(1)>/<packet(2)><space><amount><space><total>
    SELECT name,
           REGEXP_SUBSTR(first_part,'.+[[:space:]]',1,1) brand,
           REGEXP_SUBSTR(first_part,'[^[:space:]]+/',1,1) || REGEXP_SUBSTR(second_part,'[^[:space:]]+[[:space:]]',1,1) packet,
           REGEXP_SUBSTR(second_part,'[^[:space:]]+[[:space:]]',1,2) amount,
           REGEXP_SUBSTR(second_part,'[^[:space:]]+$',1) total
    FROM
      (SELECT trim(name) name,
              trim(substr(name,1, instr(name,'/'))) first_part,
              trim(substr(name,instr(name,'/')+1)) second_part
       FROM test )
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • To split a column into multiple columns

    Hi,
    I have column and i want to split it into three columns as shown below given inputs and required outputs. I have written this query to get P_1, and p_2 but dont know how to get p_3.
    SELECT ADDRESS,SUBSTR(ADDRESS,1, INSTR(ADDRESS,' ')-1) P_1
         ,SUBSTR(ADDRESS, instr(address,' ',-1)+1) P_2
         FROM TT
    Input:
    ADDRESS     
    1 AVENUE OF THE AMERICAS     
    2 NORTH CAROLINE STREET EAST     
    236 TURPENTINE ROAD COOPER CREEK     
    REQUIRED OUTPUT
    P_1     P_2     P_3     
    1     AMERICAS     AVENUE OF THE
    2     EAST     NORTH CAROLINE STREET
    236     CREEK     TURPENTINE ROAD COOPER
    Thanks in advance

    If you're on 10g or 11g you can do something like this ...
    SQL*Plus: Release 10.2.0.1.0 - Production on Tue Mar 4 21:18:07 2008
    Connected to:
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    column p_1 format a3
    column p_2 format a10
    column p_3 format a30
    with data as
    select '1 AVENUE OF THE AMERICAS' as ADDRESS from dual union all
    select '2 NORTH CAROLINE STREET EAST' as ADDRESS from dual union all
    select '236 TURPENTINE ROAD COOPER CREEK' as ADDRESS from dual
    select
      regexp_replace( address, '^([^ ]+) (.+?) ([^ ]+)$', '\1' ) as p_1 ,
      regexp_replace( address, '^([^ ]+) (.+?) ([^ ]+)$', '\3' ) as p_2 ,
      regexp_replace( address, '^([^ ]+) (.+?) ([^ ]+)$', '\2' ) as p_3
    from
      data
    P_1 P_2        P_3
    1   AMERICAS   AVENUE OF THE
    2   EAST       NORTH CAROLINE STREET
    236 CREEK      TURPENTINE ROAD COOPER
    3 rows selected.
    -- or try this shorter version --
    with data as
    select '1 AVENUE OF THE AMERICAS' as ADDRESS from dual union all
    select '2 NORTH CAROLINE STREET EAST' as ADDRESS from dual union all
    select '236 TURPENTINE ROAD COOPER CREEK' as ADDRESS from dual
    select
      regexp_replace( address, '^([^ ]+).*', '\1' ) as p_1 ,
      regexp_replace( address, '.*?([^ ]+)$', '\1' ) as p_2 ,
      regexp_replace( address, '^([^ ]+) (.+?) ([^ ]+)$', '\2' ) as p_3
    from
      data
    P_1 P_2        P_3
    1   AMERICAS   AVENUE OF THE
    2   EAST       NORTH CAROLINE STREET
    236 CREEK      TURPENTINE ROAD COOPER
    3 rows selected.See SQL Snippets: SQL Features Tutorials - Regular Expressions if you're unfamiliar with regular expressions.
    If you can't / don't want to use regular expressions then you'll need to settle for a more boring approach like this one.
    with data as
    select '1 AVENUE OF THE AMERICAS' as ADDRESS from dual union all
    select '2 NORTH CAROLINE STREET EAST' as ADDRESS from dual union all
    select '236 TURPENTINE ROAD COOPER CREEK' as ADDRESS from dual
    select
      substr( address, 1, instr( address, ' ' ) - 1 ) as p_1 ,
      substr( address, instr( address, ' ', - 1 ) + 1 ) as p_2 ,
      substr
      ( address,
        instr( address, ' ', + 1 ) + 1,
        instr( address, ' ', - 1 ) - instr( address, ' ' ) - 1
      ) as p_3
    from
      data
    P_1 P_2        P_3
    1   AMERICAS   AVENUE OF THE
    2   EAST       NORTH CAROLINE STREET
    236 CREEK      TURPENTINE ROAD COOPER--
    Joe Fuda
    SQL Snippets

  • Splitting Single Column into 3 columns.

    I have a column data like this
    85052/123755 LAURITSEN/H HENRIK S MR
    87432/119975 MORTENSEN/P PIA BUBANDT MS
    73784/127530 PEDERSEN/M MORTEN H MR
    88579/128347 JENSEN/M MORTEN MR
    ./AIRTECH STEFANSEN/P PER MR
    10024/AIRTECH HOFFMANN/M MICHAEL KJUL MR
    75922/128415 MOELLER/F FRANK MR
    17639/128440 THOMSEN/P PETER MR
    53198/127655 THYGESEN/E EBBE MR
    85960/128473 ORAEINAMZADI/M MAZYAR MR
    52663/128270 MAINZ/J JAN MR
    17639/128440 THOMSEN/P PETER MR
    27510/. HANSEN/N NILS HARLADSTED
    43885/126300 LARSEN/J JOHNNI S MR
    87580/125410 STEFANSEN/R RASMUS MR
    63215/128445 NIELSSON/J JESPER MR
    80594/123334 OLSEN/H HENRIK W MR
    I need to split this into three columns
    85052/123755 LAURITSEN/H HENRIK S MR
    should be split as
    Column1: 85052
    Column2: 123755
    Column3: LAURITSEN/H HENRIK S MR
    but in some cases it may also be like this
    ./AIRTECH STEFANSEN/P PER MR
    this should be split into
    Column1: null
    Column2: null
    Column3: AIRTECH STEFANSEN/P PER MR
    one more scenario is like this
    27510/. HANSEN/N NILS HARLADSTED
    Column1: 27510
    Column2: null
    Column3: HANSEN/N NILS HARLADSTED
    Pls Help
    Thanks
    Vinoth.

    Based on the sample data you provided,
    SQL> WITH T
      2       AS (SELECT '85052/123755 LAURITSEN/H HENRIK S MR' str FROM DUAL
      3           UNION ALL
      4           SELECT './AIRTECH STEFANSEN/P PER MR' str FROM DUAL
      5           UNION ALL
      6           SELECT '10024/AIRTECH HOFFMANN/M MICHAEL KJUL MR' str FROM DUAL
      7           UNION ALL
      8           SELECT '27510/. HANSEN/N NILS HARLADSTED' str FROM DUAL)
      9  SELECT REGEXP_REPLACE (REGEXP_SUBSTR (str, '[^/]+', 1, 1), '[^[:digit:]]') col1
    10        ,REGEXP_REPLACE (REGEXP_SUBSTR (str, '[^/]+', 1, 2), '[^[:digit:]]') col2
    11        ,REGEXP_SUBSTR (str, '[[:alpha:]].*', 1, 1) col3
    12    FROM T;
    COL1                                     COL2                                     COL3
    85052                                    123755                                   LAURITSEN/H HENRIK S MR
                                                                                      AIRTECH STEFANSEN/P PER MR
    10024                                                                             AIRTECH HOFFMANN/M MICHAEL KJUL
    27510                                                                             HANSEN/N NILS HARLADSTED
    SQL> G.

  • Splitting text column into sections

    (Using Oracle 9i SQL)
    I need to be able to split text which may be from 0 to 2000 bytes into sections of no more than 10 characters and assign a sequence to each. As usual, example is the best way to illustrate.
    The following presents the "raw" data:
    with src as (
    select     'A100000'     part_no,
         'Short'          descr
    from     dual
    UNION ALL
    select 'A100001','two words' from dual
    UNION ALL
    select 'A100002','Should be two lines' from dual
    UNION ALL
    select 'A100003','This is going to be 3' from dual
    UNION ALL
    select 'A100004','Oneverylongword' from dual
    UNION ALL
    select 'A100005','Perfectfit' from dual
    UNION ALL
    select 'A100006','' from dual
    UNION ALL
    select 'A100007','A Perfectfit but 3 lines' from dual
    UNION ALL
    select 'A100008','Toolongforone' from dual
    UNION ALL
    select 'A100009','Toolongforone too' from dual
    select     part_no,
         descr
    from     src
    PART_NO DESCR
    A100000 Short
    A100001 two words
    A100002 Should be two lines
    A100003 This is going to be 3
    A100004 Oneverylongword
    A100005 Perfectfit
    A100006
    A100007 A Perfectfit but 3 lines
    A100008 Toolongforone
    A100009 Toolongforone too
    10 rows selected.What I want is this kind of thing:
    PART_NO DESCR                           SEQ TEXT
    A100000 Short                             1 Short
    A100001 two words                         1 two words
    A100002 Should be two lines               1 Should be
    A100002 Should be two lines               2 two lines
    A100003 This is going to be 3             1 This is
    A100003 This is going to be 3             2 going to
    A100003 This is going to be 3             3 be 3
    A100004 Oneverylongword                   1 Oneverylon
    A100004 Oneverylongword                   2 gword
    A100005 Perfectfit                        1 Perfectfit
    A100006                                   0
    A100007 A Perfectfit but 4 lines          1 A
    A100007 A Perfectfit but 4 lines          2 Perfectfit
    A100007 A Perfectfit but 4 lines          3 but 4
    A100007 A Perfectfit but 4 lines          4 ines
    A100008 Toolongforone                     1 Toolongfor
    A100008 Toolongforone                     2 one
    A100009 Toolongforone too                 1 Toolongfor
    A100009 Toolongforone too                 2 one too

    Thanks although there is a bug when the text is too big:
    with src as (
    select     'Alen0000'     id,
         'Short'          str
    from     dual
    UNION ALL
    select 'Alen0001','two words' from dual
    UNION ALL
    select 'Alen0002','Should be two lines' from dual
    UNION ALL
    select 'Alen0003','This is going to be 3' from dual
    UNION ALL
    select 'Alen0004','Oneverylongword' from dual
    UNION ALL
    select 'Alen0005','Perfectfit' from dual
    UNION ALL
    select 'Alen0006','' from dual
    UNION ALL
    select 'Alen0007','A Perfectfit but 3 lines' from dual
    UNION ALL
    select 'Alen0008','Toolongforone' from dual
    UNION ALL
    select 'Alen0009','Toolongforone too' from dual
    SELECT
         ID, STRING
    FROM
         (SELECT    
              ID, LEVEL level#,
              SUBSTR (str, INSTR (str, base, 1, LEVEL) + len,
                   INSTR (SUBSTR (str, INSTR (str, base, 1, LEVEL) + len, limit# + 1),
                        base, -1) -1) STRING,
            INSTR (str, base, 1, LEVEL) + len - 1 start#,
            INSTR (SUBSTR (str, INSTR (str, base, 1, LEVEL) + len, limit# + 1), base, -1)
                   + INSTR (str, base, 1, LEVEL) + len - 1 end#
         FROM
              (SELECT
                   ROWNUM ID, ' ' base, ' ' || str || ' ' str, LENGTH (' ') len, 10 limit#
              FROM src
         CONNECT BY LEVEL <= (length (str) - length (REPLACE (str, base))) / len - 1
    START WITH start# = 1
    CONNECT BY PRIOR end# = start# and prior ID=ID
      GROUP BY ID, level#, STRING
    /ERROR at line 4:
    ORA-01436: CONNECT BY loop in user data
    yet is I change limit from 10 to 15 it is OK

  • SQL Help with change multiple columns into a single column

    I am wanting to create either a new View or a new Table based on the following original table:
    Original Table:
    Fiscal Year
    Account
    Budget_Amt_January
    Budget_Amt_February
    Budget_Amt_March
    Budget_Amt_April
    <etc. for each of the 12 months)
    I want the new View or Table to instead be:
    New:
    Fiscal_Year
    Month
    Account
    Budget_Amount
    I can't simply drop the original table, it will have to always exist since it is part of the Finance package, but for ease of reporting against I am wanting to create this new View.
    Any ideas on how to go about this?
    Thanks!

    I had to do something very similar just this week - in my case a record read from a csv into a table, then needs loading into a destination table, and the rows are columns in the csv. I went for INSERT ALL as I also had some conditions.
      INSERT ALL
        WHEN low1 != -998 OR high1 != -998 THEN
        INTO partial_profile_temp (search_id, locus_id, low_allele, high_allele)
        VALUES ( search_id, 1, low1, high1 )
        WHEN low2 != -998 OR high2 != -998 THEN
        INTO partial_profile_temp (search_id, locus_id, low_allele, high_allele)
        VALUES ( search_id, 2, low2, high2 )
        WHEN low5 != -998 OR high5 != -998 THEN
        INTO partial_profile_temp (search_id, locus_id, low_allele, high_allele)
        VALUES ( search_id, 5, low5, high5 )
        WHEN low6 != -998 OR high6 != -998 THEN
        INTO partial_profile_temp (search_id, locus_id, low_allele, high_allele)
        VALUES ( search_id, 6, low6, high6 )
        WHEN low7 != -998 OR high7 != -998 THEN
        INTO partial_profile_temp (search_id, locus_id, low_allele, high_allele)
        VALUES ( search_id, 7, low7, high7 )
        WHEN low8 != -998 OR high8 != -998 THEN
        INTO partial_profile_temp (search_id, locus_id, low_allele, high_allele)
        VALUES ( search_id, 8, low8, high8 )
        WHEN low9 != -998 OR high9 != -998 THEN
        INTO partial_profile_temp (search_id, locus_id, low_allele, high_allele)
        VALUES ( search_id, 9, low9, high9 )
        WHEN low10 != -998 OR high10 != -998 THEN
        INTO partial_profile_temp (search_id, locus_id, low_allele, high_allele)
        VALUES ( search_id, 10, low10, high10 )
        WHEN low11 != -998 OR high11 != -998 THEN
        INTO partial_profile_temp (search_id, locus_id, low_allele, high_allele)
        VALUES ( search_id, 11, low11, high11 )
        WHEN low12 != -998 OR high12 != -998 THEN
        INTO partial_profile_temp (search_id, locus_id, low_allele, high_allele)
        VALUES ( search_id, 12, low12, high12 )
        WHEN low13 != -998 OR high13 != -998 THEN
        INTO partial_profile_temp (search_id, locus_id, low_allele, high_allele)
        VALUES ( search_id, 13, low13, high13 )
        SELECT * FROM bulk_search_load bst, partial_details_temp pdt
        WHERE id = case_number -- only retrieves details for those records that are found in bulk_search_load
        AND filename like 'NETH\_%' escape '\'
        AND processed = 'N'; 

  • How do you split a column into two

    I have a huge list of names that ended up in one column. For example it says "John Smith" in one column. How do I put John in one column and smith in another without having to do each one manually?
    Your help is much appreciated. Thank you.

    PeterBreis0807 wrote:
    Copy all the text into TextEdit , Pages or any other texteditor.
    Select all the text and set up tabs on the ruler where you want the 2 columns to appear.
    Search on the space between the "John" and "Smith" and replace it with a tab.
    You can now copy and paste this into a Numbers table and it will fill the appropriate columns.
    And if the entry is John Broadus WATSON you will get an odd result !
    Yvan KOENIG (from FRANCE mercredi 15 juillet 2009 10:57:29)

  • Newbie split one column into 2 columns

    I have two columns like
    Name Dept
    Adams AA
    Davis BB
    Williams CC
    Smith DD
    Jones EE
    I want the outlook to look like
    Name Dept Name DEPT
    Adams AA Smith DD
    Davis BB Williams CC
    Jones EE
    There could be up to 100 names.
    Suggestions?
    TIA.
    Steve42

    Hi,
    An improvement of my initial query:
    Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
    Connected as hr
    SQL>
    SQL> SELECT SUM(col1),
      2         MAX(col2),
      3         SUM(col3),
      4         SUM(col4),
      5         MAX(col5),
      6         SUM(col6)
      7    FROM (SELECT col1,
      8                 col2,
      9                 col3,
    10                 col4,
    11                 col5,
    12                 col6,
    13                 ROWNUM AS pos
    14            FROM (SELECT a.*,
    15                         rownum rnum
    16                    FROM (SELECT e1.employee_id   AS col1,
    17                                 e1.first_name    AS col2,
    18                                 e1.department_id AS col3,
    19                                 NULL             AS col4,
    20                                 NULL             AS col5,
    21                                 NULL             AS col6
    22                            FROM employees e1
    23                           ORDER BY e1.employee_id) a
    24                   WHERE rownum <= (SELECT trunc(COUNT(*) / 2) FROM employees))
    25           WHERE rnum >= 0
    26          UNION
    27          SELECT col1,
    28                 col2,
    29                 col3,
    30                 col4,
    31                 col5,
    32                 col6,
    33                 ROWNUM AS pos
    34            FROM (SELECT a.*,
    35                         rownum rnum
    36                    FROM (SELECT NULL             AS col1,
    37                                 NULL             AS col2,
    38                                 NULL             AS col3,
    39                                 e2.employee_id   AS col4,
    40                                 e2.first_name    AS col5,
    41                                 e2.department_id AS col6
    42                            FROM employees e2
    43                           ORDER BY e2.employee_id) a
    44                   WHERE rownum <= (SELECT COUNT(*) FROM employees))
    45           WHERE rnum >= (SELECT ceil(COUNT(*) / 2) FROM employees))
    46   GROUP BY pos
    47   ORDER BY pos;
           100 Steven                       90        153 Christopher                  80
           101 Neena                        90        154 Nanette                      80
           102 Lex                          90        155 Oliver                       80
           103 Alexander                    60        156 Janette                      80
           104 Bruce                        60        157 Patrick                      80
           105 David                        60        158 Allan                        80
           106 Valli                        60        159 Lindsey                      80
           107 Diana                        60        160 Louise                       80
           108 Nancy                       100        161 Sarath                       80
           109 Daniel                      100        162 Clara                        80
           110 John                        100        163 Danielle                     80
           111 Ismael                      100        164 Mattea                       80
           112 Jose Manuel                 100        165 David                        80
           113 Luis                        100        166 Sundar                       80
           114 Den                          30        167 Amit                         80
           115 Alexander                    30        168 Lisa                         80
           116 Shelli                       30        169 Harrison                     80
           117 Sigal                        30        170 Tayler                       80
           118 Guy                          30        171 William                      80
           119 Karen                        30        172 Elizabeth                    80
           120 Matthew                      50        173 Sundita                      80
           121 Adam                         50        174 Ellen                        80
           122 Payam                        50        175 Alyssa                       80
           123 Shanta                       50        176 Jonathon                     80
           124 Kevin                        50        177 Jack                         80
           125 Julia                        50        178 Kimberely           
           126 Irene                        50        179 Charles                      80
           127 James                        50        180 Winston                      50
           128 Steven                       50        181 Jean                         50
           129 Laura                        50        182 Martha                       50
           130 Mozhe                        50        183 Girard                       50
           131 James                        50        184 Nandita                      50
           132 TJ                           50        185 Alexis                       50
           133 Jason                        50        186 Julia                        50
           134 Michael                      50        187 Anthony                      50
           135 Ki                           50        188 Kelly                        50
           136 Hazel                        50        189 Jennifer                     50
           137 Renske                       50        190 Timothy                      50
           138 Stephen                      50        191 Randall                      50
           139 John                         50        192 Sarah                        50
           140 Joshua                       50        193 Britney                      50
           141 Trenna                       50        194 Samuel                       50
           142 Curtis                       50        195 Vance                        50
           143 Randall                      50        196 Alana                        50
           144 Peter                        50        197 Kevin                        50
           145 John                         80        198 Donald                       50
           146 Karen                        80        199 Douglas                      50
           147 Alberto                      80        200 Jennifer                     10
           148 Gerald                       80        201 Michael                      20
           149 Eleni                        80        202 Pat                          20
           150 Peter                        80        203 Susan                        40
           151 David                        80        204 Hermann                      70
           152 Peter                        80        205 Shelley                     110
                                                      206 William                     110
    54 rows selected
    SQL> Regards,

  • Split the column into two based on conditions

    Hello,
    I have 2 tables Country and Continent.
    Continent has the data like this
    ID               Name
    1               Asia
    2              Africa
    3              North America
    4             South America
    Country has 
    ID                Name                 ContinentID            Population
    1                  China                  1                                 2000
    2                  India                   1                                 1500
    3                  Ethiopia              2                                 7500
    4                  United States       3                                5000
    I need the count of countries for each continent  break into two columns based on the population. One column showing the count of countries with population <= 2000 and the other column should show the count of countries with population >2000
    How can I achieve this?
    Please help.
    Thank you

    Here you go:
    DECLARE @continent TABLE (ID INT, Name VARCHAR(30))
    INSERT INTO @continent (ID, Name) VALUES (1, 'Asia' ),(2, 'Africa' ),(3, 'North America'),(4, 'South America')
    DECLARE @country TABLE (ID INT, Name VARCHAR(30), ContinentID INT, Population INT)
    INSERT INTO @country (ID, Name, ContinentID, Population) VALUES (1, 'China', 1, 2000),(2, 'India', 1, 1500),(3, 'Ethiopia', 2, 7500),(4, 'United States', 3, 5000)
    SELECT COUNT(*), ct.name
    FROM @country c
    INNER JOIN @continent ct
    ON c.ContinentID = ct.ID
    GROUP BY ct.name
    and for the high/low:
    DECLARE @continent TABLE (ID INT, Name VARCHAR(30))
    INSERT INTO @continent (ID, Name) VALUES (1, 'Asia' ),(2, 'Africa' ),(3, 'North America'),(4, 'South America')
    DECLARE @country TABLE (ID INT, Name VARCHAR(30), ContinentID INT, Population INT)
    INSERT INTO @country (ID, Name, ContinentID, Population) VALUES (1, 'China', 1, 2000),(2, 'India', 1, 1500),(3, 'Ethiopia', 2, 7500),(4, 'United States', 3, 5000)
    ;WITH popRank AS (
    SELECT ROW_NUMBER() OVER (PARTITION BY ct.ID ORDER BY POPULATION DESC) AS row, ct.name AS continentName, c.name AS countryName, c.population, c.ContinentID
    FROM @country c
    INNER JOIN @continent ct
    ON c.ContinentID = ct.ID
    SELECT r.countryName AS biggestPopCountry, r.population as biggestPopCount, r1.countryName AS lowestPopCountry, r1.population as lowestPopCount
    FROM popRank r
    INNER JOIN popRank r1
    ON r.ContinentID = r1.ContinentID
    AND r1.row = (SELECT MAX(row) FROM popRank WHERE ContinentID = r.ContinentID)
    AND r.row = 1

  • How to split a column into 4 sub columns of table in adf

    i hav a table and i need to make a column in to 4 sub columns. ie i havae column called scheduled under the same
    column i have 3 column releted to scheduled . how i make it possible
    Regards
    Rajesh

    Hi Rajesh,
    Something like this?
    <tr:column headerText="Schedules">
      <tr:column headerText="Schedule A">
        <tr:outputText value="#{row.bindings.ScheduleA.inputValue}"/>
      </tr:column>
      <tr:column headerText="Schedule B">
        <tr:outputText value="#{row.bindings.ScheduleB.inputValue}"/>
      </tr:column>
      <tr:column headerText="Schedule C">
        <tr:outputText value="#{row.bindings.ScheduleC.inputValue}"/>
      </tr:column>
      <tr:column headerText="Schedule D">
        <tr:outputText value="#{row.bindings.ScheduleD.inputValue}"/>
      </tr:column>
    </tr:column>Regards,
    Chan Kelwin

Maybe you are looking for

  • Can you help me with the WHERE clause? Any issue with this code block?

    Hi, I am looking for blogs or any document on how to implement a Lookup during data loads in BW. The problem is that all those that I find on this site are mostly about u201CLookup in XIu201D I have read bits and hints on different postings on this s

  • How do I get a licence deactivated that is on a dead computer

    I purchased a few years ago CS4 - I still have one licence active another was not deactivated by my ex husband who sold his laptop and the third was on a hard drive that was replaced and the licence not deactivated. I need a copy on my macbook pro th

  • How to define BPC architecture?

    Hi All, Iu2019m a BI and BPS consultant and Iu2019m doing a prototype for evaluating BPC for Sales Planning and I need some help. Process flow as: a.     Extract sales from COPA (amount and quantities); b.     Copy Actual to Budget version; c.     Cr

  • Flex Builder 3 Eclipse Plugin

    Flex Builder 3 Eclipse Pluginのダウンロードができません.サポートが終了したのでしょか?

  • Need to restrict KFF values on Charge Account Screen in Oracle Apps 11i

    Hi, I have a requirement to restrict KFF values based on certain criteria in the charge account screen in Oracle Apps 11i.. Could you pls advise on how this can be achieved. Thanks, Shashank Edited by: Shashank Senan on May 23, 2012 2:53 PM