Conditional Insertion in table based on Field

Hi all,
  I am having 3 text input fields in my page, Empno, Ename, Sal
  After inserting data in the fields, commission column has to be populate automatically, based on conditions.
  Conditions are : If the salary is less than 5000 the commission 500 has to be insert, salary is greater than 5000 commission 1000 has to be inserted.
how can I achieve this, and where I have to implement the logic, please help me out.
Thanks in Advance
Jagadish

Hi,
You can apply PPR on salary field. Then catch the event and based on condition, set the value of commission field.
Also, you can check this link for PPR:
http://sushantsharmaa.blogspot.in/2012/12/11-ppr-partial-page-rendering-in-oaf.html
--Sushant

Similar Messages

  • Generating a internal table based on the fieldcatalog

    hi,
    i want to generate an internal table based on field catalog which will be generated after the user has selected a particular layout.
    For eg. Suppose there are at present 25 fields at the ALV output and out of which user selects 10 fields using layout option and i save the layout.
    Now i want an internal table with these 10 fields in my internal table not all the 25 fields.
    any ideas?
    regards
    jignesh.

    Hi,
    Look at the sample code below.
    FIELD-SYMBOLS: <outtab> TYPE ANY TABLE,
          <l_line>  TYPE ANY,
          <l_field> TYPE ANY.
    DATA: new_table TYPE REF TO data.
    DATA: new_line  TYPE REF TO data.
    DATA: it_fieldcat TYPE lvc_t_fcat.
    DATA: wa_fieldcat TYPE lvc_s_fcat.
    DATA: BEGIN OF itab OCCURS 0,
          matnr TYPE matnr,
          aenam TYPE aenam,
          END OF itab.
    "Fill the fieldcat here
    "For example say it contains two fields MATNR AENAM
    CALL METHOD cl_alv_table_create=>create_dynamic_table
            EXPORTING
              it_fieldcatalog = it_fieldcat
            IMPORTING
              ep_table        = new_table.
    ASSIGN new_table->* TO <outtab>. "This is the required table
    CREATE DATA new_line LIKE LINE OF <outtab>.
    ASSIGN new_line->* TO <l_line> . "Work area forthe same
    SELECT matnr aenam UP TO 5 ROWS
    FROM mara
    INTO TABLE itab.
    LOOP AT itab.
      ASSIGN COMPONENT 'MATNR' OF STRUCTURE <l_line> TO <l_field>.
      <l_field> = itab-matnr.
      ASSIGN COMPONENT 'AENAM' OF STRUCTURE <l_line> TO <l_field>.
      <l_field> = itab-aenam.
      INSERT <l_line> INTO TABLE <outtab>.
    ENDLOOP.
    LOOP AT <outtab> ASSIGNING <l_line>.
      WRITE: / <l_line>.
    ENDLOOP.
    Regards,
    Manoj Kumar P

  • Insert into a final table based on a condition

    Hi,
    create table table1(invoice_number varchar2(4), covg_date date, employee_number varchar2(5),
    service_option varchar2(2), FEES VARCHAR2(5), AMOUNT NUMBER(9,2));
    insert into table1 values('1','01-JUL-2011','11','8','F1,F2',100);
    insert into table1 values('2','01-JUL-2011','12','2','F1,F2',110);
    insert into table1 values('3','01-JUL-2011','13','9','F1,F2',120);
    insert into table1 values('4','01-JUL-2011','14','3','F1,F2',130);
    commit;
    create table table2(invoice_number varchar2(4), covg_date date, employee_number varchar2(5),
    service_option varchar2(2),FEES VARCHAR2(5), AMOUNT NUMBER(9,2));
    insert into table2 values('1','01-JUL-2011','11','88','F1,F2',100);
    insert into table2 values('2','01-JUL-2011','12','2','F1,F2',110);
    insert into table2 values('3','01-JUL-2011','13','9','F1,F2',122);
    insert into table2 values('4','01-JUL-2011','14','3','F1',130);
    insert into table2 values('4','01-JUL-2011','15','3','F1',130);
    commit;
    create table final_table(insert_type varchar2(1),invoice_number varchar2(4), covg_date date, employee_number varchar2(5),
    service_option varchar2(2),FEES VARCHAR2(5), AMOUNT NUMBER(9,2));we need to insert into final_table based on the differences between table1 and table2. The condition for that is:
    Eg: For a given employee number(11) for a given covg_date(July-2011), if there is at least one difference in any column value which in this case is the service_option (8,88)..
    i need to insert table1 record into final_table with insert_type as 'OLD'
    and insert table2 record into final_table with insert_type as 'NEW'
    Similarly employee number 14, there is a difference between fees column and i should insert them like the above example
    Similarly employee number 13, there is a difference between AMOUNT column and i should insert them like the above example.
    For example employee number 15, there is no record in table1 but exists in table2 and that will be inserted as it is..
    What my idea was to loop through distinct employee_number, covg_date in table1 and check each value in table2 for the same condition and insert into final_table..
    But if there is a better option like inserting directly using select clause or some sort of direct insert without loop...
    Thanks for the help in advance

    Possibly a modified version of something like this:
    INSERT INTO final_table
    ( insert_type
    , invoice_number
    , covg_date
    , employee_number
    , service_option
    , fees
    , amount
    SELECT insert_type
         , invoice_number
         , covg_date
         , employee_number
         , service_option
         , fees
         , amount
    FROM   (
         SELECT invoice_number
              , covg_date
              , employee_number
              , service_option
              , fees
              , amount
              , 'OLD' AS insert_type
         FROM   table1
         MINUS
         SELECT invoice_number
              , covg_date
              , employee_number
              , service_option
              , fees
              , amount
              , 'OLD' AS insert_type
         FROM   table2
         UNION ALL
         SELECT invoice_number
              , covg_date
              , employee_number
              , service_option
              , fees
              , amount
              , 'NEW' AS insert_type
         FROM   table2
         MINUS
         SELECT invoice_number
              , covg_date
              , employee_number
              , service_option
              , fees
              , amount
              , 'NEW' AS insert_type
         FROM   table1
    WHERE  employee_number = :emp_number
    AND    covg_date       = TO_DATE(:date_string,'MM/DD/YYYY')
    ;

  • Set Default Value based on Field from another table for a custom object

    I'm trying to set the default value on a custom object field to the value of an account field. I have tried the syntax 50 different ways, and just am getting no where. The account field label displays as DBA, the integration tag is ltDBA_ACCT, and it shows up in reporting fx area as Account.Text_22.
    The custom object field I'm triying to update is also called DBA, which was originally the "NAME" required field. Does the table name, Account, have to be included? Do I need a function in front of the field?
    I have been updating the external ID using the row ID with syntex <ID> (Less than ID greater than) so I know it is possible to set the Default Value, but <DBA>, <ltDBA_ACCT>, "Account"."DBA", and so on just don't not work.
    If anyone knows how to enter this I'd really appreciate the help.

    Ok, so if you want to default a field to the value from another object, you have to use the JoinFieldValue function. I think you understand that, based on your original post, but I want to be sure that you do.
    Next, this will only work as a default if the record is created from the object that you wish to join on because a default works at record creation and the ID needs to be available for it to work properly. It will not work if you choose the related object record after the custom object record is created. You could set the value as a post-default, but that does not seem to meet your requirements.
    The syntax for the Default Value would be as follows: JoinFieldValue(ref_record_type, foreign_key, field_name).
    In your case, ref_record_type is '<Account>', foreign_key is &#91;<AccountId>&#93;, and field_name is '<YourFieldName>'. The best way to determine what the field name is would be to create a new workflow for Account and use the Workflow Rule Condition expression builder to pick your field ("DBA") from the list. The value that is returned by the expression builder should be placed in the field_name variable in the JoinFieldValue function (minus the brackets and in single quotes).
    Give this a shot and let me know how you do.
    Thom

  • Show or Hide empty table based on If condition

    I want to show or hide empty table based on condition. The table will be empty with 5 rows,2 cols and should display if <?Rout_Information1_id1?> is blank or null or when XML field is not present. Actually the JDEdwards report will generate XML file. In the XML file if <?Rout_Information1_id1?> is present it will have definitely value like 'PULL' or 'Cut' otherwise sometimes XML field itself will not be present. Need to display the empty table when the <?Rout_Information1_id1?> is not present. I am trying to do as below but the table is not displayed. Can someone tell me how to resolve this.
    <?if:Rout_Information1_id1=' '?>
    5 rows,2 cols table
    <?end if?>
    Thanks,
    Vijay Vattiprolu

    Ok. I used the below syntax from other post and it resolved displaying empty table issue.
    <?if:not(XML_TAG_NAME)?>
    <?end if?>
    Thanks,
    Vijay

  • Insert into table irrespective of sorting order of a field

    Hi All,
    I am not able to insert data in the data base table(YY...) as it is in the internal table.
    I do have data in following order in the internal table :
    I am simply using statement insert (database table) from (wa) in the loop...endloop.
    001   0002  2008  0000494219 001   0000494219          254.02  W4136      Keller & Kalmbach Widex
    001   0002  2008  0000198630 001   0000494219          100.10  W4136      Keller & Kalmbach Widex
    001   0002  2008  0000198418 001   0000494219           39.57  W4136       Keller & Kalmbach Widex
    001   0002  2008  0000198419 001   0000494219           89.93  W4136       Keller & Kalmbach Widex
    but when data is inserted in the table it appears as below:
    Means system is sorting the data in ascending order based on 4th column which is document number.
    001   0002  2008  0000198418 001   0000494219           39.57  W4136       Keller & Kalmbach Widex
    001   0002  2008  0000198419 001   0000494219           89.93  W4136       Keller & Kalmbach Widex 001   0002  2008  0000198630 001   0000494219          100.10  W4136      Keller & Kalmbach Widex 001   0002  2008  0000494219 001   0000494219          254.02  W4136      Keller & Kalmbach Widex
    How can I keep the sequence of data as it is in the internal table when I insert them into data base table.
    Thanks,
    Mark

    Assign one more field (let's say SEQ_NO). In your loop keep on incrementing this field and insert in database.
    You have to add this field as first primary key in your database table also.
    Hence you data will look like
    1 001 0002 2008 0000494219 001 0000494219 254.02 W4136 Keller & Kalmbach Widex
    2 001 0002 2008 0000198630 001 0000494219 100.10 W4136 Keller & Kalmbach Widex
    3 001 0002 2008 0000198418 001 0000494219 39.57 W4136 Keller & Kalmbach Widex
    4 001 0002 2008 0000198419 001 0000494219 89.93 W4136 Keller & Kalmbach Widex
    Regards,
    Mohaiyuddin

  • How to insert the image or logo into the table as a field in webdynpro abap

    Hi Friends,
    Please tell me how to insert the image or logo into the table as a field in webdynpro abap.........

    Hi Alagappan ,
          In your view layout you take table UI element and then you bind it with some context nodes.
    The attributes of your nodes comes as a field.
    Now in these fields you can set various properties and image is one of them.
    Go to ->
    1. View Layout -> Right Click on ROOTUIELEMENTCONTAINER -> INSERT ELEMENT -> TABLE
    2. Right click on table -> Create Binding.
       Here you have to bind it with the appropriate context node.
    You will get two properties here
    a- Standard Cell Editor :- ( make it image )
    b- Standard properties :- ( If required set image properties ).
    3. If you want put image from out side then import it as a mime object and set the source of your table field ( used as a image )
    also have a look :-
    [Image Properties|http://help.sap.com/saphelp_nw04/helpdata/en/f3/1a61a9dc7f2e4199458e964e76b4ba/content.htm]
    Hope this will solve your problem.
    Reply if any case of any issue.
    Thanks & Regards,
    Monishankar C

  • To modify a field in a database table based record identification by primar

    hi
    i want to to modify a field in a database table based record identification by primary key filed and two more fields
    ie customer (primary key
    i want to modify record from intenal table the record existing with primary key field customer
    the status field needs to be mofied as " value rolled"
    the below code is happening
    loop at it_record into wa_Record
    wa_inv-customer (primary key) = wa_Record=custome
    wa_inv-date = wa_Record-date
    ...so one
    append wa_inv to it_invest
    clear wa_inv
    endloop.
    if not it_invest  is initial
    modify TABle1 ( this table is data base table which needs to be mofified) based on the primary key field
    and also date field and status field which is not primary key.
    regards
    arora

    Hi there.
    Your requirement is to update a Z Database table from your internal table, right? You have several options:
    LOOP AT it_invest INTO wa_inv.
      UPDATE dbtable
         SET date = wa_inv-date
       WHERE prim_key = wa_inv-prim_key
         AND any_field = wa_inv-any_field.
    ENDLOOP.
    or
    LOOP AT it_invest INTO wa_inv.
      UPDATE dbtable FROM wa_inv. "if wa_inv of same type of dbtable
    ENDLOOP.
    In the first example, I wrote any field because you can update dbase table, filtering for fields that don't belong to the primary key. However, remember that you will change all records that respect the key you used (so, in your case, use the primary key).
    Regards.
    Valter Oliveira.

  • Change field value in a table, based on another field value in the same row (for each added row)

    Please Help, I want to change field value in a table, based on another field value in the same row (for each added row)
    I am using this code :
    <HTML>
    <HEAD>
    <SCRIPT>
    function addRow(tableID) {
    var table = document.getElementById(tableID);
    var rowCount = table.rows.length;
    var row = table.insertRow(rowCount);
    var colCount = table.rows[0].cells.length;
    for(var i=0; i<colCount; i++ ) {
    var newcell = row.insertCell(i);
    newcell.innerHTML = table.rows[1].cells[i].innerHTML;
    switch(newcell.childNodes[0].type) {
    case "text":
    newcell.childNodes[0].value = "";
    break;
    case "checkbox":
    newcell.childNodes[0].checked = false;
    break;
    case "select-one":
    newcell.childNodes[0].selectedIndex = 0;
    break;}}}
    function deleteRow(tableID) {
    try {var table = document.getElementById(tableID);
    var rowCount = table.rows.length;
    for(var i=0; i<rowCount; i++) {
    var row = table.rows[i];
    var chkbox = row.cells[0].childNodes[0];
    if(null != chkbox && true == chkbox.checked) {
    if(rowCount <= 2) {
    alert("Cannot delete all the rows.");
    break;}
    table.deleteRow(i);
    rowCount--;
    i--;}}}catch(e) {alert(e);}}
    </SCRIPT>
    </HEAD>
    <BODY>
    <INPUT type="button" value="Add Row" onClick="addRow('dataTable')" />
    <INPUT type="button" value="Delete Row" onClick="deleteRow('dataTable')" />
    <TABLE id="dataTable" width="350px" border="1">
    <TR>
    <TD width="32"></TD>
    <TD width="119" align="center"><strong>Activity</strong></TD>
    <TD width="177" align="center"><strong>Cost</strong></TD>
    </TR>
    <TR>
    <TD><INPUT type="checkbox" name="chk"/></TD>
    <TD>
    <select name="s1" id="s1">
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    </select>
    </TD>
    <TD><input type="text" name="txt1" id="txt1"></TD>
    </TR>
    </TABLE>
    </BODY>
    </HTML>

    Hi,
    Let me make sure u r working with table control.
    First u have to create a event(VALIDATE) to do the validation.
    Inside the event,
    1. First get the current index where user has pointed the curson
    2. Once u get the index read the internal table with index value.
    3. Now u can compare the col1 and col2 values and populate the error message.
    1. DATA : lo_elt TYPE REF TO if_wd_context_element,
                   l_index type i.
    lo_elt = wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).
         CALL METHOD LO_ELT->GET_INDEX( RECEIVING  MY_INDEX = l_index.
    above code should be written inside the event.
    Thanks,

  • Understanding logminer results -- inserting row into table with CLOB field

    In using log miner I have noticed that inserts into rows that contain a CLOB (I assume this applies to other LOB type fields as well, have only tested with CLOB so far) field are actually recorded as two DML entries.
    --the first entry is the insert operation that inserts all values with an EMPTY_CLOB() for the CLOB field
    --the second entry is the update that sets the actual CLOB value (+this is true even if the value of the CLOB field is not being set explicitly+)
    This separation makes sense as there may be separate locations that the values are being stored etc.
    However, what I am tripping over is the fact the first entry, the Insert, has a RowId value of 'AAAAAAAAAAAAAAAAAA' which is invalid if I attempt to use it in a flashback query such as:
    SELECT * FROM PERSON AS OF SCN #####'  where RowId = 'AAAAAAAAAAAAAAAAAA'The second operation, the Update of the CLOB field, has the valid RowId.
    Now, again, this makes sense if the insert of the new row is not really considered "+done+" until the two steps are done. However, is there some way to group these operations together when analyzing the log contents to know that these two operations are a "+matched set+"?
    Not a total deal breaker, but would be nice to know what is happening under the hood here so I don't act on any false assumptions.
    Thanks for any input.
    To replicate:
    Create a table with CLOB field:
    CREATE TABLE DEVUSER.TESTTABLE
            ID NUMBER
           , FULLNAME VARCHAR2(50)
          , AGE NUMBER  
          , DESCRIPTION CLOB
           );Capture the before SCN:
    SELECT DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER FROM DUAL;Insert a new row in the test table:
    INSERT INTO TESTTABLE(ID,FULLNAME,AGE) VALUES(1,'Robert BUILDER',35);
         COMMIT;Capture the after SCN:
    SELECT DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER FROM DUAL;Start logminer session with the bracketing scn values and options etc:
    EXECUTE DBMS_LOGMNR.START_LOGMNR(STARTSCN=>2619174, ENDSCN=>2619191, -
               OPTIONS => DBMS_LOGMNR.DICT_FROM_ONLINE_CATALOG + DBMS_LOGMNR.CONTINUOUS_MINE + -
               DBMS_LOGMNR.COMMITTED_DATA_ONLY + DBMS_LOGMNR.NO_ROWID_IN_STMT + DBMS_LOGMNR.NO_SQL_DELIMITER)Query the logs for the changes in that range:
    SELECT
           commit_scn, xid,operation,table_name,row_id
           ,sql_redo,sql_undo, rs_id,ssn
           FROM V$LOGMNR_CONTENTS
        ORDER BY xid asc,sequence# ascResults:
    2619178     0C00070028000000     START                  AAAAAAAAAAAAAAAAAA     set transaction read write
    2619178     0C00070028000000     INSERT     TESTTABLE     AAAAAAAAAAAAAAAAAA     insert into "DEVUSER"."TESTTABLE" ...
    2619178     0C00070028000000     UPDATE     TESTTABLE     AAAFEXAABAAALEJAAB     update "DEVUSER"."TESTTABLE" set "DESCRIPTION" = NULL ...
    2619178     0C00070028000000     COMMIT                  AAAAAAAAAAAAAAAAAA     commitEdited by: 958701 on Sep 12, 2012 9:05 AM
    Edited by: 958701 on Sep 12, 2012 9:07 AM

    Scott,
    Thanks for the reply.
    I am inserting into the table over a database link.
    I am using the new version of HTML Db (2.0)
    HTML Db is connected to an Oracle 10 database I think, however the table I am trying to insert data into (via the database link) is in an Oracle 8 database - this is why we created a link to it as we couldn't have the HTML Db interacting with the Oracle 8 database directly due to compatibility problems (or so I've been told)
    Simon

  • FM / BAPI to update STEUC field in marc Table basing on material and plant

    Hi,
    I need to to update STEUC field in marc Table basing on material and plant. please suggest FM / BAPI.
    Thanks.
    raviraj.

    Hi
    Try this BAPI function module:
    " BAPI_MATERIAL_MAINTAINDATA_RT "
    Data: LS_HEADDATA TYPE BAPIE1MATHEAD,
             LS_RETURN TYPE BAPIRETURN1,
              LT_PLANT TYPE TABLE OF BAPIE1MARCRT,          LS_PLANT TYPE BAPIE1MARCRT,
              LS_PLANTX TYPE BAPIE1MARCRTX,          LT_PLANTX TYPE TABLE OF BAPIE1MARCRTX.
            CALL FUNCTION 'BAPI_MATERIAL_MAINTAINDATA_RT'
                   EXPORTING
                       HEADDATA   = LS_HEADDATA
                   IMPORTING
                       RETURN     = LS_RETURN
                   TABLES
                       PLANTDATA  = LT_PLANT
                       PLANTDATAX = LT_PLANTX.
    Check the PLANTDATA in the above fm in which pass your ''STEUC'' to BAPIE1MARCRT-CTRL_CODE......
    Hope this works.....

  • Tcode to find the fields ,tables based on description of fields

    hi folks,
    tcode to find the fields ,tables based on description of fields,POINTS  will be awarded for the answers ,plz give reply.

    Hello Kumar
    Table DD03T contains the field descriptions.
    Regards
      Uwe

  • Extracting from table based on conditions from two internal tables

    Hi,
         i to have select few records from  a table based on conditions from two different internal tables. How can I achieve this.?
    ex:
          select objid from HRVPAD25 into table t_pad25
                                                    where PLVAR = 01
                                                                OTYPE = E
                                                                OBJID = itab1-sobid
                                                                sobid = itab2-pernr.
    How can this be written? can i use "for all entries..." addition with 2 tables?

    Hi Maansi_SAP,
    you can use exactly one internal table in the FOR ALL ENTRIES clause. Consider this alternative:
    data:
      itab_sobid_hash like itab1 with unique key sobid,
      ls_pad25  like line of  t_pad25.
    sort itab1.
    delete adjacend duplicates from itab1 comparing sobid.
    itab_sobid_hash = itab1.
    select objid
      into ls_pad25
      from HRVPAD25
      for all entries in itab2
      where PLVAR = '01'
        and OTYPE = E
        and sobid = itab2-pernr..
    read table itab_sobid_hash with table key sobid = ls_pad25-objid.
    check sy-subrc = 0.
    append ls_pad25 to t_pad25.
    endselect.
    You may decide if itab1 or itab2 is better used as hashed table. Make a performance test.
    The critics will tell you that SELECT ... ENDSELECT is not performant. That was very true, back in last milleniums's 90ies
    Regards,
    Clemens

  • Moving records to a table based on a condition...

    Hello experts,
    Here is the problem.
    1. select all records from table ztm0019 and put it in internal table t_ztm0019_tmp.
    2. sort t_ztm_acc_variance by sernr(serial no), datum in descending order and uzeit also in descending order.
    3. now loop t_ztm_acc_variance and at every new sernr, check whether its bwart is either 702, 708, 712, 718. Now if it is, move all of it(of the same serial no) into another table named t_ztm0019_tmp but if its bwart is not equal to the bwarts above then leave the first record and move all the remaining(with same serial no) in t_ztm0019. And then all the records that satisfied the condition must be deleted from the source table which is ztm0019.
    4. all the records of t_ztm0019_tmp would now be inserted to table ztm_acc_variance.
    example:
         SERNR        BWART
       123456         702
       123456         701
       123456         708
       123456         707
       222222         702
       222222         701
    So at every new sernr in the loop it must check whether the bwart is either 702, 708, 712, 718. If it is, then move all of the records with same sernr(123456) and so on. but if it is like this:
        SERNR        BWART
       123456         701
       123456         702
       123456         701
       123456         718
    the first record should be retained and the 2nd to last record(of the same sernr) must be moved.
    Help would really be appreciated. Thank you very much guys!

    1.
    DATA  t_ztm0019_tmp LIKE TABLE OF ztm0019 WITH HEADER LINE.
    SELECT *
    FROM ztm0019
    INTO TABLE t_ztm0019_tmp.
    2.
    SORT t_ztm_acc_variance BY <b>sernr ascending datum uzeit descending.</b>
    3.
    <b>DATA is_new TYPE i.</b>LOOP AT t_ztm_acc_variance.
    AT NEW sernr.
    IF bwart EQ '702' OR
       bwart EQ '708' OR
       bwart EQ '712' OR
       bwart EQ '718'.
    is_new = 1.
    LOOP AT t_ztm_acc_variance WHERE sernr = t_ztm_acc_variance-sernr.
    IF sy-subrc EQ 0.
    APPEND t_ztm_acc_variance TO t_ztm0019_tmp.
    DELETE t_ztm_acc_variance.
    ENDIF.
    ENDLOOP.
    ENDAT.
    IF is_new EQ 1.
    APPEND t_ztm_acc_variance TO t_ztm0019_tmp.
    DELETE t_ztm_acc_variance.
    ENDIF.
    AT END OF sernr.
    is_new = 0.
    ENDAT.
    ENDLOOP.
    4.
    CLEAR ztm_acc_variance[].
    APPEND LINES OF t_ztm0019_tmp TO ztm_acc_variance.

  • Inserting rows into table Based on Column Values.

    Hi,
    I am trying to inserting rows into a table based on Column.
    Id      Name        
    Data
    N 105.1.1
    http://www.example.com/New/105.1.1
    U 105.1.2               http://www.example.com/Used/105.1.2
    S 105.1.3               http://www.example.com/Sold/105.1.3
    I want a table like this. 
    I want to insert Data column value based on Id and Name Columns
    If Id = N and Name = 105.1.1 then Data value should be insert as   http://www.example.com/New/105.1.1
    If Id = U and Name = 105.1.2 then Data value should be  insert as  http://www.example.com/Used/105.1.2
    If Id = S and Name = 105.1.3 then Data value should be insert as   http://www.example.com/Sold/105.1.3
    Can you please help us to write query to insert above Data Column values based on Id and Name Columns.

    INSERT INTO tbl (col) SELECT
    CASE WHEN id='N' and Name='105.1.1 ' THEN 'http://www.example.com/New/105.1.1'
              WHEN id='U' and Name='105.1.2 ' THEN 'http://www.example.com/New/105.1.2'
    END col
    FROM anothertbl
    Sorry , cannot test it right now.
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

Maybe you are looking for

  • Can only export 18 minutes of 1 hour time line

    Hello I have a completely rendered, for Neat noise reduction, time line that is just over 1 hour long by about a minute.  This was an award ceremony for a client shot on Sony PMW320 camcorder with SxS card at 1080i 29.97 and set up the same in Premie

  • Error 406 access denied while trying to Add Windows 2008 HV host in SCVMM 2008.

    I am trying to add Windows 2008 HV host in SCVMM 2008. While adding host i am getting error message... Error (406) Access has been denied while contacting the server <server name>.  Recommended Action 1. Verify that the specified user account has adm

  • IPhone's USB Adapter Exchange Program

    I recently requested an exchange of my USB power adapter that came with my iPhone. The new adapter arrived and came with a shipping box to return the defective adapter, but without pre-paid postage. I don't feel that I should have to pay the postage

  • How to cancel Skype sign in tone?

    how can we cancel the start up or sign in tone of Skype?

  • Customer Num (Kunnr) using Partner Functions (PARVW) in MV45AFZZ

    Hi all, Is it possible to get the Customer Number(KUNNR) by using Partner Function (PARVW) in MV45AFZZ, how? My requirement is to get the NAME1 and NAME2, for this i need the customer number and by passing only the partner function. But in VBPA datab