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

Similar Messages

  • How to split one page into different frames in ADF?

    Hi,
    Can any one please guide me how to split a jspx into different frames.
    i.e., left frame contains <af:panelSideBar> which contains multiple <af:commandMenuItem> s. And whenver we click on the one <af:commandMenuItem>, it has to show the corresponing page inside center frame in this page itself. Is it possible in ADF? Which component we need to use?
    Can anyone guide me on this?
    Thanks in advance,
    Regards,
    Suresh Kethireddy

    You can use a combination of the ADF Faces 10.1.3 components like:
    af:panelPage
    af:panelSideBar
    af:panelHorizontal
    af:panelGroup
    to organize the screen layout, but it is not the interactive splitter that the 11g product provides.
    You can all all the 10.1.3 ADF Faces Components here:
    http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/doc/tagdoc/core/imageIndex.html

  • 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 one IDoc into two IDocs ?

    hello all,
    I wanna split one IDoc into two IDocs in XI?
    how can implement it?
    plx give some suggestions.
    thx in advance
    best regards
    Yaning
    Message was edited by:
            Yaning Liu

    Yaning,
    Please find the below blog for changing the ocurrences of IDOC
    /people/michal.krawczyk2/blog/2005/12/04/xi-idoc-bundling--the-trick-with-the-occurance-change
    Best regards,
    raj.

  • Split one row into multiple columns

    Hi,
    Data in one CLOB column in a table storing with delimiter, ##~~##. Ex. ##~~##abc##~~##defgh##~~##ijklm##~~##nopqr (data starts with delimiter). Please help me to split the data into multiple rows like below and it should be in the same order.
    abc
    defgh
    ijklm
    nopqr
    I am using Oracle 11g.
    Thanks.

    Thanks Hoek for your response. Before posting my question in the forum, I tried similar query. It is working with one character as delimiter.
    with test as (select 'ABC,DEF,GHI,JKL,MNO' str from dual )
    select regexp_substr (str, '[^,]+', 1, rownum) split
    from test
    connect by level <= length (regexp_replace (str, '[^,]+')) + 1;
    Above query is giving correct result by fetching 5 rows. I have modified the query like below...
    with test as (select 'ABC,,,DEF,,,GHI,,,JKL,,,MNO' str from dual )
    select regexp_substr (str, '[^,,,]+', 1, rownum) split
    from test
    connect by level <= length (regexp_replace (str, '[^,,,]+')) + 1;
    Above query resulting 13 rows and last 8 rows are nulls. Number of null rows are increasing, if I increase number of characters in delimiter. Could you please tell me how to avoid those null rows.
    Thanks.

  • Split one column  value and insert into multiple columns

    hi
    am new to plsql .
    i want to split a characters from one column and insert into multiple columns
    i tried used substr function the symbol ',' vary his place dynamically ,so i can't apply substr function.
    for eg:  before split
    col1 :
    col2 :
    col3 :
    col4 :
    colu5: adsdf,fgrty,erfth,oiunth,okujt
    after split
    col1 :adsd
    col2 :fgrty
    col3 :erfth
    col4 :oiunth
    col5 : adsdf,fgrty,erfth,oiunth,okujt
    can anyone help me
    thanks
    Edited by: 800324 on Dec 23, 2010 8:28 AM
    Edited by: 800324 on Dec 23, 2010 8:36 AM

    How about:
    SQL> create table t
      2  (col1 varchar2(30)
      3  ,col2 varchar2(30)
      4  ,col3 varchar2(30)
      5  ,col4 varchar2(30)
      6  ,col5 varchar2(30)
      7  );
    Table created.
    SQL> insert into t (col5) values ('adsdf,fgrty,erfth,oiunth,okujt');
    1 row created.
    SQL> insert into t (col5) values ('x,y');
    1 row created.
    SQL> insert into t (col5) values ('a,b,c,d');
    1 row created.
    SQL> select * from t;
    COL1                           COL2                           COL3                           COL4                           COL5
                                                                                                                                adsdf,fgrty,erfth,oiunth,okujt
                                                                                                                                x,y
                                                                                                                                a,b,c,d
    3 rows selected.
    SQL>
    SQL> merge into t a
      2  using ( with t1 as ( select col5||',' col5
      3                       from   t
      4                     )
      5          select substr(col5, 1, instr(col5, ',', 1, 1)-1) col1
      6          ,      substr(col5, instr(col5, ',', 1, 1)+1, instr(col5, ',', 1, 2)- instr(col5, ',', 1, 1)-1) col2
      7          ,      substr(col5, instr(col5, ',', 1, 2)+1, instr(col5, ',', 1, 3)- instr(col5, ',', 1, 2)-1) col3
      8          ,      substr(col5, instr(col5, ',', 1, 3)+1, instr(col5, ',', 1, 4)- instr(col5, ',', 1, 3)-1) col4
      9          ,      rtrim(col5, ',') col5
    10          from   t1
    11        ) b
    12  on ( a.col5 = b.col5 )
    13  when matched then update set a.col1 = b.col1
    14                             , a.col2 = b.col2
    15                             , a.col3 = b.col3
    16                             , a.col4 = b.col4
    17  when not matched then insert (a.col1) values (null);
    3 rows merged.
    SQL> select * from t;
    COL1                           COL2                           COL3                           COL4                           COL5
    adsdf                          fgrty                          erfth                          oiunth                         adsdf,fgrty,erfth,oiunth,okujt
    x                              y                                                                                            x,y
    a                              b                              c                              d                              a,b,c,d
    3 rows selected.
    SQL> Assuming you're on 9i...

  • Splitting one column into two columns

    Hi,
    How to create two columns in one column header using JTable swing concept in java.
    Thanks in advance

    [http://forum.java.sun.com/thread.jspa?threadID=488822&messageID=2297054]
    you can use MultiLineHeaderRenderer class for this purpose. search for that class and examples
    sunil

  • How to split one monitor into two, differently configured desktops

    Hello,
    I have a 27" iMac. I would like to split the screen into two differently configured desktops or monitors. Apps like TwoUp or Divy don't exactly do this. I'll explain it with an example:
    Suppose I'm working on a document and I need to open many folders to retrieve files. One common problem is that opened folders overlap each other and sometimes they overlap with the document I'm working on, or they go underneath the document. I would like to split the screen vertically in, say, two virtual, independent desktops/monitors, like this:
    - one window/space on one side (say, on the left) of the screen would contain the document  from top to bottom, with no dock bar on the bottom
    - the other window/space (right) would behave as a regular, full desktop, with the entire dock on the bottom
    In this way, if I need to navigate to find a file to use in the document, I would move the cursor to the right. The Finder would work only in this window/space, thus windows or other applications would never overlap or clutter the left side of the screen. Drag-and-drop from right to left should be possible.
    One way to imagine it is as if the 16x9 monitor were comprised by two vertical, 8x9 independent monitors side by side, each with its own configuration.
    Is this possible? Can anyone recommend an application or type of setup?
    Thank you,
    -celso

    Looking for something like this?
    You can tell Display Maid to save the positions of your open windows across many apps and later restore those positions when things become a mess. With Display Maid you don’t have to restore windows one at a time, or even one app at a time. Display Maid restores all saved window positions across all apps with one command. It will also restore window positions automatically when it detects a workspace change.
    http://www.funk-isoft.com/index.php/display-maid

  • ICal splits one event into two, how do I fix this?

    I have one weekly repeating event entered.  For the first two weeks it shows up like normal, as one event.  But two weeks later it splits that one event into two different side-by-side bubbles.  I did not alter the event.  Does any one else have this problem?  How can I fix this?

    That is because you are sharing an Apple ID.
    On both phones go to:
    Settings > Facetime > turn off iPhone Cellular Calls
    I would also suggest you check here to make sure your husbands number is not checked on your phone or yours on his:
    Settings > Messages > Send & Receive
    Settings > Facetime
    Otherwise you will get each others Messages and FaceTime calls.
    I recommend that you each get your own Apple IDs if for nothing else than iCloud, iMessage & FaceTime.

  • Help... Why did the dvd to ipod converter split one movie into 2 files?

    I have a 80GB Video Ipod and I'm confused on why when I ripped a dvd using the dvd to ipod converter for mac program it split the dvd into 2 files.. Is there a way I can merge the files together so it is 1 file?.. I would apprciate any help or suggestions...
    G3 Ibook.. 15, 40 and 80GB Video Ipods... G4 PowerMac   Mac OS X (10.4.2)  

    Go to their support forum and ask-you will get a better answer from people who actually use the program.
    It's not a paid for program is it?
    A totally free program that rips and converts DVD's for Macs can be found here: http://handbrake.m0k.org/
    Why would anyone on a Mac pay for a DVD rip program?

  • How to split one request into many to reduce response time

    Hi,
    In a request I may get more than 20-30 materials for which, pricing info need to be returned. Its increasing the load on SAP and XI is not waiting for a long time to get the price. Please let me know a work around for this otherthan BPM.
    Or is there any mechanism by which I can split the XML into multiple XMLs and process multi small requests.
    Thanks
    Seshu

    Hi Seshu -
    Timeouts can be tricky in synchronous cases with all the various components of XI.  In your case, you've implied that the RFC receiver adapter is being used to talk to SAP and it's taking a long time for SAP to process this request and send back a response.  Are you getting a '...MessageExpiredException'?  If so, the parameter 'xiadapter.inbound.timeout.default' in the 'SAP XI Adapter: XI' J2EE service would be relevant (see Note 791379 for details).  The 'syncMessageDeliveryTimeoutMsec' parameter of the 'SAP XI Adapter: RFC' J2EE service is only relevant if you're using the RFC sender adapter.
    Other timeout settings may come into play.  <a href="http://service.sap.com/~sapidb/011000358700005909032005E/XI30XI70_TroubleGuide.pdf">The XI Troubleshooting guide</a> has some good information on this.
    Also, if this scenario is required to be synchronous, there's no way to split the request without using BPM as synchronous requests cannot be sent to multiple receivers.
    Regards,
    Jin

  • PRE9: How to split one clip into two (or more) clips?

    I can't believe this is so hard to do... But HOW?

    You don't necessarily need to separate the file into individual clips.  When you do a cut on the timeline, this is a virtual cut, leaving the original file untouched but determining what will appear in the output.  You can split the clip into multiple pieces, delete the bits you don't want, add transitions, insert new bits, whatever you want, all without affecting the original file in any way.  Once you're happy, you output a new file using the Share options, and you get a new video file, with your original files still untouched.
    If you want to split your file into multiple individual files, you can use the sliders on the time scale, and export (Share) using the Share Work Area Only checkbox.  If you're doing this for purposes of reassembly, it would be better to save the individual clips in as lossless a format as possible, the default AVI format taking considerably more space but not losing quality.  Hint: the sliders can be positioned to the time marker using Alt-[ and Alt-].  Once you've done this, note that your original file will still be there, untouched.
    There is also VideoRedo Plus, a cheap program which gives frame-accurate selection and allows rapid subdivision of a piece of footage.  It doesn't re-render as PE9 would (this is where loss of image quality creeps in using compressed formats such as MPEG), copying the original frames.  You can then reassemble the bits using your video editor.

  • Split one column value into two columns using t-sql

    Hi All,
    I have one varchar column in a table.
    Col1
    ABC-12C4
    BC-A345
    CD
    XYZ
    How to split this into two columns like this using t-sql
    Col1   Col2
    ABC    12C4
    BC      A345
    CD     
    XYZ
    Thanks,
    RH
    sql

    assuming a static delimiter, and the split will end up with a max of 2 columns, something like this would work.  basically you just need to determine where the delimiter is, and then use the left and right functions to find the 2 pieces.
    declare @t table(value varchar(10))
    insert into @t(value)
    values
    ('ABC-12C4'), ('BC-A345'), ('CD'), ('XYZ')
    select
    case
    when charindex('-', value) != 0 then left(value, charindex('-', value) - 1)
    else value
    end as col1,
    case
    when charindex('-', value) != 0 then right(value, len(value) - charindex('-', value))
    else ''
    end as col2
    from @t

  • 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,

  • How to split one characteristic into 2 columns in query

    Hi,
    There is a characteristic TASK, which has a navigation attribute Phase Indicator, and if Phase Indicator = 1, then this Task is a Phase, or else it's a normal Task.
    Now I want to have a result with 2 columns like:
    Phase     Normal Task
    PH1        T1
    PH1        T2
    PH2        T3
    PH2        T4
    Could you give any advice on how to realize it?
    Thanks in advance!
    Regards,
    Napoleon

    Hi Napoleon,
    In ur query create 2 selections and give description as phase and normal task.
    In the 'phase' sleection drag 'task' as info object and give restriction for the nav attribute 'phase indicator' with 1.
    Similarly in the 'normal task' selection again drag 'task' as info object and give restriction for the nav attribute 'phase indicator' with not equal to 1.Hope it helps
    Regards,
    Rathy

Maybe you are looking for