Creation of new table with attributes of another ??

how can i create a new table which has the same attributes as another ? Please note that the records/tuples in the already existing table shouldn't be copied into the new table.
Illustration:
Table Employee_Details with attributes/fields Name and IDno is present.
A new table Supervisor should have the same attributes/fields Name and IDno.
But the data in Employee_Details table shouldn't be copied into this table (Supervisor).
Can anyone write a query in SQL that does the same i.e. use the attributes of another table during the creation of a new one?
Also can anyone explain why the following query is erroneous ?
sql> create table supervisor as (desc employee_details);
Thanks for your help!

create table new_table as select * from old_table
where 0=1;This statement doesn't create the new_table in the same tablespace than old_table... to take for example only the tablespace, but that's right for storage clause too.
Assuming TITI is my old table, and TOTO my new table :
SQL> show user
USER is "H89UCBAC"
SQL> select default_tablespace from dba_users where username='H89UCBAC';
DEFAULT_TABLESPACE
PSDEFAULT
SQL> create table titi(coltiti number) tablespace tools;
Table created.
SQL> create table toto as select * from titi;
Table created.
SQL> ed
Wrote file afiedt.buf
  1* select table_name,tablespace_name from dba_tables where table_name in ('TITI','TOTO')
SQL> /
TABLE_NAME                     TABLESPACE_NAME
TOTO                           PSDEFAULT
TITI                           TOOLS
SQL>   1* select replace(dbms_metadata.get_ddl('TABLE','TITI'),'TITI','TOTO') from dual
SQL> /
REPLACE(DBMS_METADATA.GET_DDL('TABLE','TITI'),'TITI','TOTO')
  CREATE TABLE "H89UCBAC"."TOTO"
   (    "COLTOTO" NUMBER
   ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 65536 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
  TABLESPACE "TOOLS"
SQL> drop table toto;
Table dropped.
SQL> CREATE TABLE "H89UCBAC"."TOTO"
  2   (    "COLTOTO" NUMBER
  3   ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  4  STORAGE(INITIAL 65536 NEXT 65536 MINEXTENTS 1 MAXEXTENTS 2147483645
  5  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
  6  TABLESPACE "TOOLS"
  7  /
Table created.
SQL> select table_name,tablespace_name from dba_tables where table_name in ('TITI','TOTO');
TABLE_NAME                     TABLESPACE_NAME
TITI                           TOOLS
TOTO                           TOOLS
SQL> HTH,
Nicolas.
Message was edited by:
N. Gasparotto

Similar Messages

  • EEWB: Insert New Table with more than one key field  for BP object

    Hi Gurus,
    I want to enhance Business Partner object with a new table with two key fields, one the address number and another a sequence number, because I need to save several entries for each address belonging to a determined business partner. Something as what happens in communication data (i.e fax number)for an address.
    I have run the wizard from EEWB but the only possibility that offers you is to create only one key field for the new custom table. There is something in EEWB to achieve this, two key fields for the new table?
    Another question is the following: which Badi or BAPI must I enhance to populate my table with the corresponding address number to which the data belong to?
    I mean my custom data are filled through a table control that I have allocated within the screen sequence BUA130 (Detail Address). Thus, when a new address is added to a BP and my particular table control is populated within this address I should fill the key fields from my table (address number and sequence number) when the BP were saved. So, I must know beforehand which address number the system will assign to this new address.
    I repeat the question: which Badi or BAPI must I enhance to populate my table with the corresponding address number to which the data belong to?
    Thanks in Advance.
    Regards,
    Rosa Ferrando

    Hi Rosa,
    Please go through the following links. It will help you.
    <a href="http://help.sap.com/saphelp_crm50/helpdata/en/20/a4ffee7e0fcc4ebb7e5466d3903d38/frameset.htm">http://help.sap.com/saphelp_crm50/helpdata/en/20/a4ffee7e0fcc4ebb7e5466d3903d38/frameset.htm</a>
    <b>Reward points if it helps.</b>
    Regards,
    Amit Mishra

  • Can I create a new table using strcuture of another existing table ????

    hello all -
    If I need to create table as the duplicate table for another table. I donot need data from that table, as I am going to populate date later on.
    So all need is the structure, constraints of the table to create a new table.
    create table new_temp as
    select * from old_temp;
    above command creates a table with the data, what if I donot want the data, only the defination.
    Any help woud really appreciated.
    Thanks
    Rama

    but create table as select..
    CAN'T create constraint on new table it copy only data
    not constraint
    so create new table with structure as well as
    constraint use
    SELECT dbms_metadata.get_ddl('TABLE','EMP') FROM DUAL;
    only in 9i
    kuljeet pal singh

  • Hi guys n girls. How do you copy a whole table to create a new table with all cell sizes in tact? Thanks for your help. Jason.

    Hi guys n girls. How do you copy a whole table to create a new table with all cell sizes in tact? Thanks for your help. Jason.
    when you copy n paste into a new table, all the cell sizes are changed.
    is there a way to put in a new table from your templates into an existing file, different to the standard very basic ones in insert table.
    I look forward to your answers.  Your help is very much appreciated.
    Also how do you search for question answers already written in this support area please.

    Hi Jason,
    In Numbers 3, you can select a whole table by clicking once in the table to make it active, then click once on the "bull's eye" at the top left.
    Now copy and paste. All formatting (and any cell content) is pasted intact. In Numbers 2.3 (Numbers '09) it is a little different for selecting a whole table. But I won't go into that unless you are using Numbers '09. Please reply.
    I don't like the look of the tables in Insert Table. I keep custom tables in My Templates. I have set Numbers > Preferences > General > For New Documents > Use template: (name of my favourite custom template)
    That opens when I launch Numbers, or ask for a new document (command n). Note that if you follow this preference setting, then Menu > File > New From Template Chooser (for another template) requires you to hold down the option key in that menu.
    Regards,
    Ian.
    Message was edited by: Yellowbox. All formatting (and any cell content) is pasted intact.

  • Creation of New Table for Delivery Output Type.

    Hi Guys,
    I need to replace an existing table by creating a new Table in the existing Access Sequence with the combination of "Ship to Party/Product Hierarchy".
    Logistics>Shipping>basic Shipping functions>Output determination>Maintain Condition Tables-->maintain output condition table for deliveries.
    I am choosing a new table by the name 902, but i am not getting the field " PRODH Product Hierarchy" on the right hand side to choose from.
    I checked the field catelog also. Firstly the field catelog was also not having the field, and then i added the field in it by choosing new entries.
    I guess i am missing some step in between, thats why the new field (PRODH) is not showing on the right hand side while creation of the condition table.
    One more thing, when i am seeing the Field Catelog, i am able to see a very large number of fields, then why only a few are appearing during creation of a new table??????
    Can you guys correct me and let me find a way.????
    Thanks very much indeed.
    Regards,
    Vivek

    Hi If u have already the field in FC u can add with new entries .
    Try with ,enter t- code <b>SE11</b>, enter <b>KOMB</b>- it will ask for access key get from basis and add u r Field catalog
    Field catalog for condition key: output determination
    If at all u want a new field tao add to u r FC u Can try with userexit.
    1)ADDING OF NEW FIELDS IN PRICING  
    In Pricing in SD the fields on the basis of which pricing is done are derived from the FIELD CATALOG which is a structure KOMG .This structure is used to transfer transaction data to the pricing procedure in SD and is also known as communication structure.This structure KOMG consists of two tables KOMK for Header related fields and KOMP for item related fields.
       The fields which are not in either of the two tables KOMK and KOMP
    cannot be used in pricing .Sometimes a need arises when the pricing
    is to be based on some other criteria which is not present in the form of fields in either of the two tables.
      This problem can be solved by using USEREXITS which are provided for pricing in SD.
      Pricing takes place both when the SALES ORDER ( Transaction VA01) is created as well as when INVOICING ( Transaction VF01) is done.Hence SAP provides 2 userexits ,one for sales order processing which is
    USEREXIT_PRICING_PREPARE_TKOMP  or
    USEREXIT_PRICING_PREPARE_TKOMK
    Depending upon which table (KOMK or KOMP) the new fields were inserted we use either of the above two userexits.These userexits are found in include MV45AFZZ of the standard SAP sales order creation program SAPMV45A.
    In the case of userexit which will be called when invoicing is done ,these
    are provided in the include RY60AFZZ which is in the standard SAP
    program SAPMV45A. The name of the userexits are same. i.e
    USEREXIT_PRICING_PREPARE_TKOMP  or
    USEREXIT_PRICING_PREPARE_TKOMK
    These userexits are used for passing the data from the communication structure to the pricing procedure, for this we have to fill the newely
    created field in the communication structure KOMG for this we fill the code in the above userexit using the MOVE statement after the data that
    has to be passed is taken from the database table by using the SELECT statement. The actual structure which is visible in these userexits and which is to be filled for that particular field is TKOMP or TKOMK.
    Before the coding for these userexits is done ,it is necessary to create a new field in either of the two tables KOMK or KOMP .For this purpose
    includes are provided in each of them .
    To create the field in header data(KOMK) the include provided is KOMKAZ
    and to create the field in item data(KOMP) the include provided is KOMPAZ.
    One possible example for the need of creating new fields can be e.g. Frieght to be based upon transportation zone ,for this no field is available in field catalog and hence it can be created in KOMK and then above userexits can be used to fill the transportation data to it.
    2)The other method of finding userexit is to find the word USEREXIT in the
    associated program of the transaction for which we want to determine userexit using SE38.
    3)The other method of finding userexits is to find the include in case of SD/MM applications where the userexits are located ,this can be found in the SAP reference IMG generally in the subfolder under SYSTEM MODIFICATION.
    Some other examples of userexits in SD are:<b></b>
    Message was edited by:
            SHESAGIRI GEDILA

  • Creation of new program with reference to IW31Transaction

    Hello Experts,
    I have a unique requierement where I need to create a zprogram which is similar to create plant Maintenance Order Tcode IW31.
    My requirement is in my new zprogram I just need one screen with the header data which includes order type, Functional location. Plant , main work center area and Text.
    Below that I just need to create a table control which is of components similar to component tabstrip in IW31.
    I have created a new screen with these inputs but I am unable to know how can i run the logic similar to iw31.
    Can anyone let me know the  how to go about this since I cannot make a copy of standard Transaction as I am new to module pool/Programs.
    Thanks and Regards,
    Nikhil.

    Hi,
    ... but if you prefer FM, then you can use BAPI_MATERIAL_MAINTAINDATA_RT or BAPI_MATERIAL_SAVEDATA, depending if you are using Retail or not. BDC is usually not possible for all views - which you would need for complete creation.
    Regards,
    Christian

  • Fill dynamic internal table with data from another dynamic table

    Hi,
    I have a huge dynamic table with a few columns and need to fill another dynamic table with some of the columns, that are also existing in the other one. I first know at runtime, which fields the smaller table contains.
    Until now, I did it that way:
      LOOP AT <it_tab_structure> ASSIGNING <wa_tab_structure>.
        LOOP AT lt_comp_full INTO ls_comp_full.
          ASSIGN COMPONENT ls_comp_full-name OF STRUCTURE <structure> TO <column>.
          ASSIGN COMPONENT ls_comp_full-name OF STRUCTURE <wa_tab_structure> TO <value>.
          <column> = <value>.
        ENDLOOP.
        APPEND <structure> TO <table>.
      ENDLOOP.
    lt_comp_full contains the columns of the second table, that have to be filled.
    This is taking a very long time, as there can be a lot of columns in the source table and the source table contains at least 100000 records.
    Is there therefore any way to fill the other table faster?
    Thank you & best regards,
    Michael

    Hey Sharath,
    thank you for your answer! Unfortunately I don't have a 7.4 system here, but your example pointed out, that I can also use move-corresponding from one structure to the other, which I thought, was not possible. I'm trying out, if this makes it faster now.
    I'll let you all know, if this made the deal.
    Thank you & best regards,
    Michael & Arne

  • Updating one table with colum of another one

    Oracle 11g
    Hi,
    i'im trying to update two colums from SUPPORT (SUPPORT_X, SUPPORT_Y) table with two colums of POST_HTA_BT( POSTHTABT_GPS_X, POSTHTABT_GPS_Y ) table
    Understand that the two tables have the colum below:
    SUPPORT(SUPPORT_ID,SUPPORT_PLAQUE,POSTHTABT_ID,SUPPORT_X, SUPPORT_Y,....)
    POST_HTA_BT (POSTHTABT_ID,POSTHTABT_GPS_X, POSTHTABT_GPS_Y,..)
    The SUPPORT_PLAQUE has the varachar type. Except the keys, other colums are varchar type in the two tables.
    The point here is to update the support_x, support_y with posthtabt_gps_x and posthtabt_gps_y.But before update we must cheik if the fifth number of support plaque is a character number between "0" to "9' and if the rest of the caracter of the support_plaque is '00000'
    Please note that the support_plaque is stored in the table with the form: "0025800000"!!!
    So i did the script below i'm trying to execute in sql developper.
    SET SERVEROUTPUT ON
    DECLARE
       chiffre_liste varchar(200):= '0','1','2','3','4','5','6','7','8','9';
       CURSOR CUR_GPS_SUPPORT IS
           select SUPPORT.SUPPORT_X,SUPPORT.SUPPORT_Y,POSTE_HTA_BT.POSTHTABT_ID,SUPPORT.EXPL_ID,
                  SUPPORT.SUPPORT_PLAQUE,POSTHTABT_GPS_X,POSTHTABT_GPS_Y
              from   SUPPORT,
                   POSTE_HTA_BT
            where
              SUPPORT.SUPPORT_X  IS NULL and
              SUPPORT.SUPPORT_Y  IS NULL and
              SUPPORT.POSTHTABT_ID   = POSTE_HTA_BT.POSTHTABT_ID and
              SUPPORT.EXPL_ID  = POSTE_HTA_BT.EXPL_ID
              order by SUPPORT.POSTHTABT_ID;
           w_POSTHTABT_ID         POSTE_HTA_BT.POSTHTABT_ID%type;
           w_SUPPORT_X            SUPPORT.SUPPORT_X%TYPE;
           w_SUPPORT_Y            SUPPORT.SUPPORT_Y%TYPE;
           w_EXPL_ID              SUPPORT.EXPL_ID%TYPE;
           w_SUPPORT_PLAQUE       SUPPORT.SUPPORT_PLAQUE%TYPE;
           w_POSTHTABT_GPS_X      POSTE_HTA_BT.POSTHTABT_GPS_X%TYPE;
           w_POSTHTABT_GPS_Y      POSTE_HTA_BT.POSTHTABT_GPS_Y%TYPE;
    BEGIN
        DBMS_OUTPUT.PUT_LINE('Chargement des coordoonnées GPS -Mise à jour Coord GPS des supports de Départ');
         FOR CUR IN  CUR_GPS_SUPPORT LOOP
              w_POSTHTABT_ID    :=   cur.POSTHTABT_ID;
              w_SUPPORT_PLAQUE  :=   cur.SUPPORT_PLAQUE;
              w_SUPPORT_X       :=   cur.SUPPORT_X;
              w_SUPPORT_Y       :=   cur.SUPPORT_Y;
              w_POSTHTABT_GPS_X :=   cur.POSTHTABT_GPS_X;
              w_POSTHTABT_GPS_Y :=   cur.POSTHTABT_GPS_X;
            if substr(cur.support_plaque,5,1)  in chiffre_liste  and substr(cur.support_plaque,6,5)='00000'
               w_SUPPORT_X := CUR.POSTHTABT_GPS_X
               w_SUPPORT_Y := CUR.POSTHTABT_GPS_Y
            END if;
            EXCEPTION WHEN NO_DATA_FOUND THEN w_SUPPORT_X := NULL and w_SUPPORT_Y := NULL;
            END;
            --Update de la table des supports
             update SUPPORT
                set SUPPORT_X            = w_SUPPORT_X,
                    SUPPORT_Y            = w_SUPPORT_Y
             where  SUPPORT_PLAQUE       = w_SUPPORT_PLAQUE;
             -- On valide imm?diatement
             commit;
             EXCEPTION when no_data_found then null;
             -- Pas de coordonnées trouvées
             END;
    END;
    and i got the following errors:
    Rapport d'erreur :
    ORA-06550: Line 2, colum 34 :
    PLS-00103: Symbole "," rencontré à la place d'un des symboles suivants :
       * & = - + ; < / > at in is mod remainder not rem
       <exposant (**)> <> or != or ~= >= <= <> and or like like2
       like4 likec between || multiset member submultiset
    ORA-06550: Ligne 2, colonne 52 :
    PLS-00103: Symbole ";" rencontré à la place d'un des symboles suivants :
       ) , * & = - + < / > at in is mod remainder not rem =>
       <exposant (**)> <> or != or ~= >= <= <> and or like like2
       like4 likec between || multiset member subm
    ORA-06550: Line 38, colum 48 :
    PLS-00103: Symbole "CHIFFRE_LISTE" rencontré à la place d'un des symboles suivants :
    Symbole "(" a été substitué à "CHIFFRE_LISTE" pour continuer.
    ORA-06550: Line 39, colum 12 :
    PLS-00103: Symbole "W_SUPPORT_X" rencontré à la place d'un des symboles suivants :
       ) , * & - + / at mod remainder rem <exposant (**)> and or ||
       multiset
    ORA-06550: Line 40, colum 12 :
    PLS-00103: Symbole "W_SUPPORT_Y" rencontré à la place d'un des symboles suivants :
       . ( ) , * @ % & = - + < / > at in is mod remainder not rem
       <exposant (**)> <> or != or ~= >= <= <> and or like like2
       like4 likec between || mult
    ORA-06550: Line 41, colum 9 :
    PLS-00103: Symbole "END" rencontré à la place d'un des symboles suivants :
       . ( ) , * @ % & = - + < / > at in is mod remainder not rem
       <exposant (**)> <> or != or ~= >= <= <> and or like like2
       like4 likec between || multiset memb
    06550. 00000 -  "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:
    I verified the line number, but don't see the error in my code.
    Please could you help me?
    peace

    Here the new  script
    SET SERVEROUTPUT ON
    DECLARE
       TYPE chiffre_liste IS TABLE OF VARCHAR2(10);
        my_list  chiffre_liste;
       CURSOR CUR_GPS_SUPPORT IS
           select SUPPORT.SUPPORT_X,SUPPORT.SUPPORT_Y,POSTE_HTA_BT.POSTHTABT_ID,SUPPORT.EXPL_ID,
                  SUPPORT.SUPPORT_PLAQUE,POSTHTABT_GPS_X,POSTHTABT_GPS_Y
              from   SUPPORT,
                   POSTE_HTA_BT
            where
              SUPPORT.SUPPORT_X  IS NULL and
              SUPPORT.SUPPORT_Y  IS NULL and
              SUPPORT.POSTHTABT_ID   = POSTE_HTA_BT.POSTHTABT_ID and
              SUPPORT.EXPL_ID  = POSTE_HTA_BT.EXPL_ID
              order by SUPPORT.POSTHTABT_ID;
           w_POSTHTABT_ID         POSTE_HTA_BT.POSTHTABT_ID%TYPE;
           w_SUPPORT_X            SUPPORT.SUPPORT_X%TYPE;
           w_SUPPORT_Y            SUPPORT.SUPPORT_Y%TYPE;
           w_EXPL_ID              SUPPORT.EXPL_ID%TYPE;
           w_SUPPORT_PLAQUE       SUPPORT.SUPPORT_PLAQUE%TYPE;
           w_POSTHTABT_GPS_X      POSTE_HTA_BT.POSTHTABT_GPS_X%TYPE;
           w_POSTHTABT_GPS_Y      POSTE_HTA_BT.POSTHTABT_GPS_Y%TYPE;
    BEGIN
        DBMS_OUTPUT.PUT_LINE('Chargement des coordoonnées GPS -Mise à jour Coord GPS des supports de Départ');
        my_list := chiffre_liste('0','1','2','3','4','5','6','7','8','9');
         FOR CUR IN  CUR_GPS_SUPPORT LOOP
              w_POSTHTABT_ID    :=   cur.POSTHTABT_ID;
              w_SUPPORT_PLAQUE  :=   cur.SUPPORT_PLAQUE;
              w_SUPPORT_X       :=   cur.SUPPORT_X;
              w_SUPPORT_Y       :=   cur.SUPPORT_Y;
              w_POSTHTABT_GPS_X :=   cur.POSTHTABT_GPS_X;
              w_POSTHTABT_GPS_Y :=   cur.POSTHTABT_GPS_X;
            if substr(cur.support_plaque,5,1) in (my_list) then
                 if substr(cur.support_plaque,6,5)='00000' then
                     w_SUPPORT_X := CUR.POSTHTABT_GPS_X;
                     w_SUPPORT_Y := CUR.POSTHTABT_GPS_Y;
                 End if;
            END if;
            --EXCEPTION WHEN NO_DATA_FOUND THEN w_SUPPORT_X,w_SUPPORT_Y := NULL ;
            --END;
            --Update de la table des supports
             update SUPPORT
                set SUPPORT_X            = w_SUPPORT_X,
                    SUPPORT_Y            = w_SUPPORT_Y
             where  SUPPORT_PLAQUE       = w_SUPPORT_PLAQUE;
             -- On valide imm?diatement
             commit;
             --EXCEPTION when no_data_found then null;
             --Pas de coordonnées trouvées
             --END;
          END LOOP;
    END;
    And i got the error:
    Rapport d'erreur :
    ORA-06550: Ligne 40, colonne 12 :
    PLS-00383: non-concordance de type détectée à 'SUBSTR' dans une clause IN ou NOT IN
    ORA-06550: Ligne 40, colonne 9 :
    PL/SQL: Statement ignored
    06550. 00000 -  "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:
    I think to do a loop with your i idea, something like this:
    DECLARE
    TYPE liste_1 IS TABLE OF NUMBER INDEX BY VARCHAR2(10);
    my_list  liste_1;
    Begin
       my_list('0') := 1;
       my_list('1') := 1;
       my_list('2') := 1;
       my_list('3') := 1;
       my_list('4') := 1;
       my_list('5') := 1;
       my_list('6') := 1;
       my_list('7') := 1;
       my_list('8') := 1;
       my_list('9') := 1;
        for i in my_list  loop
           if substr(cur.support_plaque,5,1) in my_list(i)  then
                 if substr(cur.support_plaque,6,5)='00000' then
                     w_SUPPORT_X := CUR.POSTHTABT_GPS_X;
                     w_SUPPORT_Y := CUR.POSTHTABT_GPS_Y;
                 End if;
           End if;
       End loop
    END;
    What do you think?

  • Join multiple tables to create one new table with data from all the other

    CREATE TABLE NAME2012 (STOCKNAME2012 VARCHAR(255), VAL2012 FLOAT)
    INSERT INTO NAME2012 VALUES (‘Stock3’, 50)
    INSERT INTO NAME2012 VALUES (‘Stock2’, 55)
    INSERT INTO NAME2012 VALUES (‘Stock4’, 45)
    CREATE TABLE NAME2011 (STOCKNAME2011 VARCHAR(255), VAL2011 FLOAT)
    INSERT INTO NAME2011 VALUES (‘Stock1’, 56)
    INSERT INTO NAME2011 VALUES (‘Stock2’, 48)
    INSERT INTO NAME2010 VALUES (‘Stock3’, 59)
    CREATE TABLE NAME2010 (STOCKNAME2010 VARCHAR(255), VAL2010 FLOAT )
    INSERT INTO NAME2010 VALUES (‘Stock1’, 47)
    INSERT INTO NAME2010 VALUES (‘Stock2’, 46)
    I would like a new Table STOCKS populated with names of stocks from the other tables as well as values. So I get a new table STOCKS, with data as below.
    CREATE TABLE STOCKS (NAME VARCHAR(255), VALUE2012 FLOAT , VALUE2011 FLOAT, VALUE2010 FLOAT)
    End result in table STOCKS should be like:
    NAME               VALUE2010              VALUE2011             
    VALUE2012
    Stock1                 47                          
    56                            NULL
    Stock2                 46                          
    48                             50
    Stock3                NULL                         59                          
     55
    Stock4                NULL                       NULL                         
    45
    How can I write a T-SQL expression that could do this?

    Hi
    There must be StockMaster
    Try this
    CREATE TABLE NAME2012 (
    STOCKNAME2012 VARCHAR(255)
    ,VAL2012 FLOAT
    INSERT INTO NAME2012
    VALUES (
    'Stock3'
    ,50
    INSERT INTO NAME2012
    VALUES (
    'Stock2'
    ,55
    INSERT INTO NAME2012
    VALUES (
    'Stock4'
    ,45
    CREATE TABLE NAME2011 (
    STOCKNAME2011 VARCHAR(255)
    ,VAL2011 FLOAT
    INSERT INTO NAME2011
    VALUES (
    'Stock1'
    ,56
    INSERT INTO NAME2011
    VALUES (
    'Stock2'
    ,48
    CREATE TABLE NAME2010 (
    STOCKNAME2010 VARCHAR(255)
    ,VAL2010 FLOAT
    INSERT INTO NAME2010
    VALUES (
    'Stock1'
    ,47
    INSERT INTO NAME2010
    VALUES (
    'Stock2'
    ,46
    INSERT INTO NAME2010
    VALUES (
    'Stock3'
    ,59
    Create table stockMaster(STOCKNAME VARCHAR(255))
    go
    Insert into stockMaster values('Stock1')
    Insert into stockMaster values('Stock2')
    Insert into stockMaster values('Stock3')
    Insert into stockMaster values('Stock4')
    Select Distinct S.STOCKNAME , A.VAL2010 ,B.VAL2011,C.VAL2012 from  stockMaster S
    left join NAME2012  C on S.STOCKNAME = C.STOCKNAME2012
    left join NAME2011 B on s.STOCKNAME = B.STOCKNAME2011
    left join NAME2010 A on s.STOCKNAME = A.STOCKNAME2010
    go
    Drop table NAME2010
    Drop table NAME2011
    Drop table NAME2012
    Drop table stockMaster 
    Mark as Ans if you find it useful
    Shridhar J Joshi Thanks a lot

  • Creation of a table with static data(not a DB table)

    Hi
    I need to display a table with some static data in an OAF page. This table is not a DB table. It is like an HTML table
    I have placed the following query
    SELECT 'A1','B1' FROM DUAL UNION SELECT 'A2',B2' FROM DUAL in the VO. But it is returning a single row which is acting as the header of the table.
    Can anyone help me to create the table with 2 rows inserted in it.
    Thanks
    Edited by: gsaxena on Aug 4, 2009 3:04 AM
    Edited by: gsaxena on Aug 4, 2009 5:24 AM

    Hi
    Please execute your VO inside the CO of table region ,right now it is not getting executed,thats y it is giving just column names
    use the following code PR method of CO
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    OAViewObject oav = (OAViewObject)am.findViewObject("XXVO");
    oav.first();
    let me know in case of any issue
    thanx
    Pratap

  • Replicate in the Master controller and creation of new user with cisco prime infrastructure 2.1.

    Hello!!
    We have multiple controllers Cisco WLC 5508 (all running software version 7.6.120.0) distributed in various buildings and a controller in other control building (also Cisco WLC 7.6.120.0 5508) operating as Master and backup of the buildings's controllers . 
    Each building is radiated such an SSID that is used as a validation of the user connected to that SSID web portal each controller (in the WLAN, Security -> Layer 3 -> Web Policy), using the local database to validate the user. 
    The problem is that the local database of users is not being replicated between controllers buildings and the Master controller, so if you drop the controller of a building, the Master controller begins to provide service to the buildings access points, but the equivalent radiated SSID cannot able to validate users. 
    I need know if it's possible through Cisco Prime Infrastruture 2.1, first replicate in the Master controller on the basis of existing controllers buildings each local data and, second, that the creation of new users are automatically perform both the controllers like to the Master .
    Thanks.

    As noted earlier, it is not advisable to use the root user to log in for normal use. New users and groups can be created by navigating to Administration > Users, Roles & AAA as shown in the preceding figures. It would help to chalk out what are the various levels at which you want to distribute the users, and to create those roles first. It doesn’t really matter whether you create users or groups first. New users can be easily added by going to Administration > Users, Roles & AAA > Users > Add Users > Select “Add Users” from the drop-down on the right side. Once you get into the add user workflow, fill in the username, password, and local authorization for this user as shown in the figure below.
    A virtual domain can also be assigned to the users when you define their roles by selecting the virtual domain on the left side and moving it to the right side as shown in the image below (left).

  • Create new table with new calculated entries

    Hi,
    I got a little problem.
    I have a table which includes the vacations times of employees. The vacation time was periodic ,so I split them in to days. Now I want to calculate the exact days.Sometimes there are weekends included which I have to subtract. I flaged every day, that I exactly know which day is a working day and which one isn't. Is there a way that I only sum the working days without the weekends?
    Table Vacation_Times:
    Empl --- V_Start_D --- V_End_D --- Date --- Days --- D_Name
    Mr.A --- 01.05.11 --- 06.05.11 --- 01.05.11 --- 6 --- Wednesday
    Mr-A --- 01.05.11 --- 06.06.11 --- 02.05.11 --- 6 --- Thursday
    Mr.A --- 01.05.11 --- 06.05.11 --- 03.05.11 --- 6 --- Friday
    Mr-A --- 01.05.11 --- 06.06.11 --- 04.05.11 --- 6 --- Saturday
    Mr.A --- 01.05.11 --- 06.05.11 --- 05.05.11 --- 6 --- Sunday
    Mr-A --- 01.05.11 --- 06.06.11 --- 06.05.11 --- 6 --- Monday
    NEW table:
    Empl --- V_Start_D --- V_End_D --- Date --- Days --- D_Name --- Actual_Days
    Mr.A --- 01.05.11 --- 06.05.11 --- 01.05.11 --- 6 --- Wednesday --- 4
    Mr-A --- 01.05.11 --- 06.06.11 --- 02.05.11 --- 6 --- Thursday --- 4
    Mr.A --- 01.05.11 --- 06.05.11 --- 03.05.11 --- 6 --- Friday --- 4
    Mr-A --- 01.05.11 --- 06.06.11 --- 04.05.11 --- 6 --- Saturday --- 4
    Mr.A --- 01.05.11 --- 06.05.11 --- 05.05.11 --- 6 --- Sunday --- 4
    Mr-A --- 01.05.11 --- 06.06.11 --- 06.05.11 --- 6 --- Monday --- 4
    thx

    Hi,
    try
    SELECT Empl ,V_Start_D ,V_End_D ,Date ,Days ,D_Name , count(*) as Actual_Days
    FROM vacation v
    JOIN datelist d ON d.day between  V_Start_D and V_End_D and d.is_working_day='Y'
    GROUP BY Empl ,V_Start_D ,V_End_D ,Date ,Days ,D_Name Regards,
    Carsten.

  • Dynamic Creation of Internal table WITH HEADER LINE

    Dear,
    Please show me the way of creating Internal table WITH HEADER LINE dynamically..
    Thanks,
    Nirav

    <font color='blue'>Hi Parekh,
    Have a look at the sample program for Dynamic internal table
    This program has been developed to update any table data in the dictionary. We give table name and File name as Input fields.
    <pre>
    REPORT znpmmm0201.
    *Types
    TYPES:
          BEGIN OF ty_file,
            data(4096) TYPE c,
          END OF ty_file.
    *Type-pools
    TYPE-POOLS:
          truxs.
    *Work areas
    DATA:
          wa_file      TYPE ty_file.
    *Internal tables
    DATA:
          it_file      TYPE STANDARD TABLE OF ty_file,
          it_data      TYPE truxs_t_text_data.
    DATA:
          gv_dref TYPE REF TO data,
          file_name TYPE string.
    *FIELD-SYMBOLS
    FIELD-SYMBOLS:
                   <gf_itab> TYPE STANDARD TABLE,
                   <wa>      TYPE ANY.
    *& Selection-screen
    PARAMETERS:
          p_table TYPE rsrd1-tbma_val,
          p_file  TYPE ibipparms-path.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      PERFORM f4_for_p_file CHANGING file_name .
    *& START-OF-SELECTION
    START-OF-SELECTION.
      CREATE DATA gv_dref TYPE TABLE OF (p_table).
      ASSIGN gv_dref->* TO <gf_itab>.
      PERFORM upload_data USING file_name.
      MODIFY (p_table) FROM TABLE <gf_itab>.
    *&      Form  UPLOAD_DATA
    FORM upload_data USING file.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = file
          filetype                = 'ASC'
        TABLES
          data_tab                = it_file.
      APPEND LINES OF it_file TO it_data.
      CLASS cl_abap_char_utilities DEFINITION LOAD.
      DATA: l_field_seperator.
      l_field_seperator = cl_abap_char_utilities=>horizontal_tab.
      REPLACE ALL OCCURRENCES OF '|' IN TABLE it_data WITH l_field_seperator.
      CALL FUNCTION 'TEXT_CONVERT_TEX_TO_SAP'
        EXPORTING
          i_field_seperator    = l_field_seperator
          i_tab_raw_data       = it_data
        TABLES
          i_tab_converted_data = <gf_itab>.
    ENDFORM.                    " UPLOAD_DATA
    *&      Form  F4_FOR_p_file
    FORM f4_for_p_file CHANGING file.
      DATA:
            l_field_name LIKE  dynpread-fieldname VALUE 'P_FILE'.
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
          field_name    = l_field_name
        IMPORTING
          file_name     = p_file.
      file = p_file.
    ENDFORM.                    " F4_FOR_p_file </pre>
    Thanks,
    Venkat.O</font>

  • Creation of new material with reference to other material

    Hi All,
    I have requirement where i have to create new selling unit material with reference to the given material.
    Now, can any buddy suggest which FM or BADI i have to use to read BOM and ROUTING  info of reference material and same to create BOM and ROUTING for new material.
    Doing this with BDC after reading data directally from tables is one option, But i am looking for any BADI or Fm which will serve the purpose.
    Thanks in Advance,
    Rahul

    Hi,
    ... but if you prefer FM, then you can use BAPI_MATERIAL_MAINTAINDATA_RT or BAPI_MATERIAL_SAVEDATA, depending if you are using Retail or not. BDC is usually not possible for all views - which you would need for complete creation.
    Regards,
    Christian

  • Create a Union query that automatically adds/contains new tables with a similar name

    Dear All, 
    For a research project i am upscaling from an Access database to SQL server/ SQL azure since the database got far too large. Now i am quite well known with Access, but to be quite honest, I am a SQL rookey. So a lot to learn for me here. 
    what I need is a union query that automatically adds new research dumps to the query. All research dumps have a table name starting with TD_EXP (Table Dump _ Export). In Access VBA I simply made a loop that builds up the SQL statement, but i have no clue
    how to do this within SQL Server...
    So, I need the UNION Query to select * from TD_Exp_2012_06_06_15_48 UNON all the  TD_Exp_XXXX_XX_XX_XX_XX that are added in the database,
    Who could help me out please with a dynamic SQL statement. 
    Best regards  Jurjen

    you can use INFORMATION_SCHEMA.TABLES view for that
    do like below
    DECLARE @Query varchar(max)
    SELECT @Query = STUFF((SELECT ' UNION ALL ' + 'SELECT * FROM ' + TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE 'TD_EXP%' FOR XML PATH('')),1,11,'')
    SELECT @Query
    Add one more condition as below if you want to exclude views from above 
    DECLARE @Query varchar(max)
    SELECT @Query = STUFF((SELECT ' UNION ALL ' + 'SELECT * FROM ' + TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE 'TD_EXP%' AND TABLE_TYPE = 'BASE TABLE' FOR XML PATH('')),1,11,'')
    SELECT @Query
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

Maybe you are looking for