How to update and insert the records without using Table_comparison and Map_operation?

How to update and insert the records without using Table_comparison and Map_operation?

Use either join or MERGE see this Inserting, Updating, and Deleting Data by Using MERGE

Similar Messages

  • My macbook froze up. Finger gestures work, but I cant close out of any windows. How do I close out the windows without using the track pad?

    My macbook froze up. Finger gestures work, but I can't close out of any windows by clicking on the red "X". How do I close out the windows without using the track pad?

    Command + W will close a window. Command + Q will quit a program.

  • How to update around 12 lac record when using co-related update

    Hello Everyone
    I have two tables and 14 columns in them are similar, I mean have the same name
    Now I want to update 1 column using the records in the other table by using join condition so I wrote a code but as the records are around 12 lac which need to be updated so my code hangs after 25%
    UPDATE TABLE  A
    SET A.COLUMN1=(SELECT B.COLUMN1
                         FROM  TABLEL B
                         WHERE B.COLUMN2 = A.COLUMN2
                         AND B.COLUMN3 = A.COLUMN3
                         AND B.COLUMN4= A.COLUMN4
                         AND B.COLUMN5 =A. COLUMN5
                         AND B.COLUMN6 = A.COLUMN6
                         AND B.COLUMN7=A.COLUMN7
                         AND B.COLUMN8 = A.COLUMN8
                         AND B.COLUMN9 = A.COLUMN9
                         AND B.COLUMN10 = A.COLUMN10
                         AND B.COLUMN11 = A.COLUMN11
                         AND B.COLUMN12 = A.COLUMN12
                         AND B.COLUMN13 = A.COLUMN13
                         AND A.PLAN_ID = 1000000300
                         AND B.PLAN_ID = 1000000300)
    WHERE COLUMN14= 1000000300  
    AND COLUMN15=1000000002please suggest a way that the update could be done easily
    Edited by: Peeyush on Feb 8, 2011 5:56 AM
    Edited by: Peeyush on Feb 8, 2011 5:57 AM

    You can rewrite it using a merge statement, to prevent starting that subquery numerous times.
    Here is an example that mimics your situation, with two tables containing only 10 rows:
    SQL> create table table_a
      2  ( column1
      3  , column2
      4  , column3
      5  , column4
      6  , column5
      7  , column6
      8  , column7
      9  , column8
    10  , column9
    11  , column10
    12  , column11
    13  , column12
    14  , column13
    15  , column14
    16  , column15
    17  , plan_id
    18  )
    19  as
    20   select -1
    21        , level
    22        , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
    23        , 1000000300
    24        , case mod(level,2) when 0 then 1000000002 else 1000000000 end
    25        , 1000000300
    26     from dual
    27  connect by level <= 10
    28  /
    Table created.
    SQL> create table table_b
      2  as
      3  select rownum column1
      4       , column2
      5       , column3
      6       , column4
      7       , column5
      8       , column6
      9       , column7
    10       , column8
    11       , column9
    12       , column10
    13       , column11
    14       , column12
    15       , column13
    16       , column14
    17       , column15
    18       , plan_id
    19    from table_a
    20  /
    Table created.
    SQL> select * from table_a
      2  /
       COLUMN1    COLUMN2    COLUMN3    COLUMN4    COLUMN5    COLUMN6    COLUMN7    COLUMN8    COLUMN9   COLUMN10   COLUMN11   COLUMN12   COLUMN13   COLUMN14   COLUMN15    PLAN_ID
            -1          1          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000000 1000000300
            -1          2          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000002 1000000300
            -1          3          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000000 1000000300
            -1          4          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000002 1000000300
            -1          5          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000000 1000000300
            -1          6          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000002 1000000300
            -1          7          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000000 1000000300
            -1          8          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000002 1000000300
            -1          9          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000000 1000000300
            -1         10          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000002 1000000300
    10 rows selected.
    SQL> alter session set statistics_level = all
      2  /
    Session altered.
    SQL> UPDATE TABLE_a A
      2  SET A.COLUMN1=(SELECT B.COLUMN1
      3                       FROM  TABLE_b B
      4                       WHERE B.COLUMN2 = A.COLUMN2
      5                       AND B.COLUMN3 = A.COLUMN3
      6                       AND B.COLUMN4= A.COLUMN4
      7                       AND B.COLUMN5 =A. COLUMN5
      8                       AND B.COLUMN6 = A.COLUMN6
      9                       AND B.COLUMN7=A.COLUMN7
    10                       AND B.COLUMN8 = A.COLUMN8
    11                       AND B.COLUMN9 = A.COLUMN9
    12                       AND B.COLUMN10 = A.COLUMN10
    13                       AND B.COLUMN11 = A.COLUMN11
    14                       AND B.COLUMN12 = A.COLUMN12
    15                       AND B.COLUMN13 = A.COLUMN13
    16                       AND A.PLAN_ID = 1000000300
    17                       AND B.PLAN_ID = 1000000300)
    18  WHERE COLUMN14= 1000000300
    19  AND COLUMN15=1000000002
    20  /
    5 rows updated.
    SQL> select * from table(dbms_xplan.display_cursor(null,null,'allstats last'))
      2  /
    PLAN_TABLE_OUTPUT
    SQL_ID  2xky09vcgyzpr, child number 0
    UPDATE TABLE_a A SET A.COLUMN1=(SELECT B.COLUMN1                      FROM
    TABLE_b B                      WHERE B.COLUMN2 = A.COLUMN2
    AND B.COLUMN3 = A.COLUMN3                      AND B.COLUMN4= A.COLUMN4
                AND B.COLUMN5 =A. COLUMN5                      AND B.COLUMN6 =
    A.COLUMN6                      AND B.COLUMN7=A.COLUMN7                      AND
    B.COLUMN8 = A.COLUMN8                      AND B.COLUMN9 = A.COLUMN9
             AND B.COLUMN10 = A.COLUMN10                      AND B.COLUMN11 =
    A.COLUMN11                      AND B.COLUMN12 = A.COLUMN12
    AND B.COLUMN13 = A.COLUMN13                      AND A.PLAN_ID = 1000000300
                    AND B.PLAN_ID = 1000000300) WHERE COLUMN14= 1000000300 AND
    COLUMN15=1000000002
    Plan hash value: 4173428670
    | Id  | Operation           | Name    | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
    |   1 |  UPDATE             | TABLE_A |      1 |        |      0 |00:00:00.01 |      25 |
    |*  2 |   TABLE ACCESS FULL | TABLE_A |      1 |      5 |      5 |00:00:00.01 |       3 |
    |*  3 |   FILTER            |         |      5 |        |      5 |00:00:00.01 |      15 |
    |*  4 |    TABLE ACCESS FULL| TABLE_B |      5 |      1 |      5 |00:00:00.01 |      15 |
    Predicate Information (identified by operation id):
       2 - filter(("COLUMN14"=1000000300 AND "COLUMN15"=1000000002))
       3 - filter(:B1=1000000300)
       4 - filter(("B"."COLUMN2"=:B1 AND "B"."COLUMN3"=:B2 AND "B"."COLUMN4"=:B3 AND
                  "B"."COLUMN5"=:B4 AND "B"."COLUMN6"=:B5 AND "B"."COLUMN7"=:B6 AND
                  "B"."COLUMN8"=:B7 AND "B"."COLUMN9"=:B8 AND "B"."COLUMN10"=:B9 AND
                  "B"."COLUMN11"=:B10 AND "B"."COLUMN12"=:B11 AND "B"."COLUMN13"=:B12 AND
                  "B"."PLAN_ID"=1000000300))
    Note
       - dynamic sampling used for this statement
    40 rows selected.Note that you have 5 starts of operation 4, meaning 5 full table scans.
    SQL> select * from table_a
      2  /
       COLUMN1    COLUMN2    COLUMN3    COLUMN4    COLUMN5    COLUMN6    COLUMN7    COLUMN8    COLUMN9   COLUMN10   COLUMN11   COLUMN12   COLUMN13   COLUMN14   COLUMN15    PLAN_ID
            -1          1          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000000 1000000300
             2          2          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000002 1000000300
            -1          3          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000000 1000000300
             4          4          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000002 1000000300
            -1          5          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000000 1000000300
             6          6          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000002 1000000300
            -1          7          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000000 1000000300
             8          8          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000002 1000000300
            -1          9          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000000 1000000300
            10         10          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000002 1000000300
    10 rows selected.
    SQL> rollback
      2  /
    Rollback complete.
    SQL> merge into table_a a
      2  using table_b b
      3     on (   a.column2  = b.column2
      4        and a.column3  = b.column3
      5        and a.column4  = b.column4
      6        and a.column5  = b.column5
      7        and a.column6  = b.column6
      8        and a.column7  = b.column7
      9        and a.column8  = b.column8
    10        and a.column9  = b.column9
    11        and a.column10 = b.column10
    12        and a.column11 = b.column11
    13        and a.column12 = b.column12
    14        and a.column13 = b.column13
    15        and a.plan_id  = 1000000300
    16        and b.plan_id  = 1000000300
    17        and a.column14 = 1000000300
    18        and a.column15 = 1000000002
    19        )
    20   when matched then
    21        update set a.column1 = b.column1
    22  /
    5 rows merged.
    SQL> select * from table(dbms_xplan.display_cursor(null,null,'allstats last'))
      2  /
    PLAN_TABLE_OUTPUT
    SQL_ID  by8mwr4pxfv46, child number 0
    merge into table_a a using table_b b    on (   a.column2  = b.column2       and a.column3  = b.column3
    and a.column4  = b.column4       and a.column5  = b.column5       and a.column6  = b.column6       and
    a.column7  = b.column7       and a.column8  = b.column8       and a.column9  = b.column9       and
    a.column10 = b.column10       and a.column11 = b.column11       and a.column12 = b.column12       and
    a.column13 = b.column13       and a.plan_id  = 1000000300       and b.plan_id  = 1000000300       and
    a.column14 = 1000000300       and a.column15 = 1000000002       )  when matched then       update set
    a.column1 = b.column1
    Plan hash value: 1110892605
    | Id  | Operation            | Name    | Starts | E-Rows | A-Rows |   A-Time   | Buffers |  OMem |  1Mem | Used-Mem |
    |   1 |  MERGE               | TABLE_A |      1 |        |      1 |00:00:00.01 |      13 |       |       |          |
    |   2 |   VIEW               |         |      1 |        |      5 |00:00:00.01 |       6 |       |       |          |
    |*  3 |    HASH JOIN         |         |      1 |      1 |      5 |00:00:00.01 |       6 |   778K|   778K|  573K (0)|
    |*  4 |     TABLE ACCESS FULL| TABLE_A |      1 |      5 |      5 |00:00:00.01 |       3 |       |       |          |
    |*  5 |     TABLE ACCESS FULL| TABLE_B |      1 |     10 |     10 |00:00:00.01 |       3 |       |       |          |
    Predicate Information (identified by operation id):
       3 - access("A"."COLUMN2"="B"."COLUMN2" AND "A"."COLUMN3"="B"."COLUMN3" AND "A"."COLUMN4"="B"."COLUMN4"
                  AND "A"."COLUMN5"="B"."COLUMN5" AND "A"."COLUMN6"="B"."COLUMN6" AND "A"."COLUMN7"="B"."COLUMN7" AND
                  "A"."COLUMN8"="B"."COLUMN8" AND "A"."COLUMN9"="B"."COLUMN9" AND "A"."COLUMN10"="B"."COLUMN10" AND
                  "A"."COLUMN11"="B"."COLUMN11" AND "A"."COLUMN12"="B"."COLUMN12" AND "A"."COLUMN13"="B"."COLUMN13")
       4 - filter(("A"."PLAN_ID"=1000000300 AND "A"."COLUMN14"=1000000300 AND "A"."COLUMN15"=1000000002))
       5 - filter("B"."PLAN_ID"=1000000300)
    Note
       - dynamic sampling used for this statement
    36 rows selected.And with the merge you have only one.
    SQL> alter session set statistics_level = typical
      2  /
    Session altered.
    SQL> select * from table_a
      2  /
       COLUMN1    COLUMN2    COLUMN3    COLUMN4    COLUMN5    COLUMN6    COLUMN7    COLUMN8    COLUMN9   COLUMN10   COLUMN11   COLUMN12   COLUMN13   COLUMN14   COLUMN15    PLAN_ID
            -1          1          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000000 1000000300
             2          2          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000002 1000000300
            -1          3          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000000 1000000300
             4          4          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000002 1000000300
            -1          5          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000000 1000000300
             6          6          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000002 1000000300
            -1          7          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000000 1000000300
             8          8          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000002 1000000300
            -1          9          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000000 1000000300
            10         10          1          1          1          1          1          1          1          1          1          1      1 1000000300 1000000002 1000000300
    10 rows selected.On 1.2M rows, the savings should be considerable.
    Regards,
    Rob.

  • How to insert the records using sql query

    hi,
    i insert the record uisng sql query and DOTNET programme successfully and increase the doc num .ubut when i try to  add record using SAP B1 the old Doc no show.It means its not consider the docnums which are not inserted by sql query.
    how can i solve this problem?
    Regards,
    M.Thippa Reddy

    You are not support use Insert / Update / Delete on SAP Databases directly.
    SAP will not support any database, which is inconsistent, due to SQL-Queries, which modify datasets or the datastructure of the SAP Business One Database. This includes any update-, delete- or drop-statements executed via SQL-Server Tools or via the the query interface of SAP Business One
    Check SAP Note: 896891 Support Scope for SAP Business One - DB Integrity
    [https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/smb_searchnotes/display.htm?note_langu=E&note_numm=896891]

  • HT4623 I have tried resetting an iPhone 3 and I am unable to activate and sync it. How can I reset the device without using a computer?

    I have tried resetting an iPhone 3 and I am unable to activate and sync it. How can I reset the device without using a computer?

    Hello anacc,
    Thanks for using Apple Support Communities.
    For more information on this, take a look at:
    iOS: Unable to update or restore
    http://support.apple.com/kb/HT1808
    Connect your USB cable to your computer but not to the iPhone, iPad, or iPod touch until step 3.
    Turn off the device: Press and hold the Sleep/Wake button for a few seconds until the red slider appears, then slide the slider. Wait for the device to turn off.If you cannot turn off the device using the slider, press and hold the Sleep/Wake and Home buttons at the same time. When the device turns off, release the Sleep/Wake and Home buttons.
    While pressing and holding the Home button down, connect the USB cable to the iPhone, iPad, or iPod touch. The device should turn on.
    Continue holding the Home button until you see the Connect to iTunes screen. When this screen appears, you can release the Home button:
    Note: If the image of a battery appears, let the device charge for at least ten minutes to ensure that the battery has some charge, and then start with step 2 again. If you don't see the Connect to iTunes screen, try these steps 1 through 4 again.
    iTunes should automatically open and display the following message:
    "iTunes has detected an iPhone in recovery mode. You must restore this iPhone before it can be used with iTunes."Note: If iTunes not open after two minutes, please open iTunes yourself.
    Use iTunes to restore the device.
    Best of luck,
    Mario

  • How do I transfer music from one iPhone to the other without using a laptop and will I be billed?

    How do I transfer music from one iPhone to the other without using a laptop and will I be billed?

    Download Past Purchases
    http://support.apple.com/kb/HT2519
    Or do you mean this...
    Old Phone to New Phone
    http://support.apple.com/kb/HT2109
    Also...
    It should be Noted that anything Downloaded with a Particular Apple ID is tied to that Apple ID and Cannot be Merged or Transferred to a Different Apple ID

  • I have an Apple Powerbook G4, and my monitor doesn't function. I have an external display Monitor, however it's stuck in extended screen mode. How do I get it to mirror or duplicate the display without use of the on-board?

    As i had said, I have an Apple Powerbook G4, and my monitor doesn't function. I have an external display Monitor, however it's stuck in extended screen mode. How do I get it to mirror or duplicate the display without use of the on-board? Is there a Fn key combo i'm missing or is the issue more serious then i realize? any and all help and hints would be greatly apprichiated, thanks in advance.
    -Powerbook User

    The PowerBooks have an F-key that toggles mirrored and extended mode. My PB is loaned out right now but I think it was f7. The keycap has an icon on two overlapping rectangles, as I recall.
    EDIT: Yes! Found a pdf of the PB manual it shows F7 is the toggle:

  • I have an iphone 5s and my kids have ipods. How do i set up the ipods to use facetime and messaging without it going through my iphone?

    i have an iphone 5s and my kids have ipod touches. How do i set up the ipods to use facetime and messaging without it going through my iphone or rather using my apple id? Is this possible? Does each device need its own apple ID and/or icloud email?

    Try unchecking your phone number and email address (if present) under You can be reached by FaceTime (iMessage) at in Settings>Messages>Send & Receive and Settings>FaceTime on their devices.  Also uncheck their email address (if present) on your phone.
    Otherwise have them use separate Apple IDs for these services (tap the ID, sign out, sign back in with a different ID).  You can do this and still share the same ID for other services such as iTunes.

  • How Can insert the records into Excel_sheet by using SQL Task-SSIS ?

    As per requirement ,
    insert the records in excel sheet(DT)  by using SQL Task-SSIS .
    I used SQL query in SQL Task-SSIS:
    e.g.., INSERT INTO [DT$B1:B1] VALUES ('COMMM')
    but error:Executing the query "INSERT INTO [DT$B1:B1] VALUES ('COMMM') " failed with the following error: "This table contains cells that are outside the range of cells defined in this spreadsheet.". Possible failure reasons: Problems
    with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
    Please any suggestion  ...
    -MADHU

    then first create a table inside Excel sheet based on your source data. You can Execute sql task for that using excel connection. then use insert to populate it
    see an example here where I create a dynamic sheet using execute sql task
    http://visakhm.blogspot.in/2013/09/exporting-sqlserver-data-to-multiple.html
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • My friend borrowed my old iPhone 4. I wanted to erase all the data but I dont have a password and my friend doesnt know his password. How can I erase the data without using a password?

    My friend borrowed my iPhone. I want to sell the iPhone, but first I have to erase all the data that belong too my friend. I don't know his password and he doesn't know either. Is it possible to erase the data without using a password?
    thanks!

    You need the password if it is iCloud locked you won't be able to activate the phone for use.
    As long as he remembers his email,  you can reset the password
    If you forgot your Apple ID password
    or Forgot Apple ID
    https://iforgot.apple.com/appleid
    If it is a lock screen password, you can do a restore.
    Hold down power and home for 10 seconds and release power but keep holding down home. iTunes will say your phone is in recovery mode so you can restore it.

  • How to update fields in the target table in correspondance with the source file values

    Environment: win7, SQL server 2008 R2
    Application: Microsoft Management SQL Studio 2008 R2, Business Intelligence 2008 - SSIS
    SSIS competency level: Novice
    Problem: I have been trying to update some of the fields in the destination table,student table, in reference to data set in the staging table and ssn table.  I was able to insert/load new data to the destination using look up transformation
    while the driver is ssn (data mapping) but i couldn't know how to update some of the fields in the student table while keeping the orignal pn_id of both tables(ssn and student tables), because pn_id already exists in the SSN table and student table. There
    are other records also associated with the pn_id so I am not allowed to update the pn_id in the destination tables. For example,
    SSN Table (pn_id,ssn)
    ('000616850',288258466)
    ('002160790',176268917)
    Staging Table (ssn, id, pn_id, name, subject, academic year, comments)
    (288258466, 1001, '770616858',Sally Johnson, English,A, 2005,'great student')
    (176268917, 1002, '192160792',Will Smith, Math,38000,C, 2014,'no comments')
    (444718562, 1003, '260518681',Mike Lira, Math,38000,B, 2013,'no comments')
    Student Table (destination table)(id,pn_id,subject,academic year, grade, comments):
    (1001, '000616850', ' ',' ', ,'')
    (1002, '002160790', ' ',' ', ,'')
    Expected Results:
    My goal is to have student table updated as the following:
    Student Table
    (1001, '000616850', 'English','A' ,2005 ,'great student')
    (1002, '002160790', 'Math ',' C',2014 ,'no comments')
    please advise

    Why can't you use simple UPDATE command in EXECUTE SQL Task as below,
    DROP TABLE SSN
    DROP TABLE STAGING
    DROP TABLE STUDENT
    CREATE TABLE SSN(pn_id VARCHAR(100),ssn BIGINT)
    INSERT INTO SSN VALUES('000616850',288258466)
    INSERT INTO SSN VALUES('002160790',176268917)
    CREATE TABLE Staging (ssn BIGINT, id INT, pn_id BIGINT, name VARCHAR(100), subject VARCHAR(100),grade VARCHAR(10), [academic year] INT, comments VARCHAR(100))
    INSERT INTO Staging VALUES(288258466, 1001, '770616858','Sally Johnson', 'English','A', 2005,'great student')
    INSERT INTO Staging VALUES(176268917, 1002, '192160792','Will Smith', 'Math','C', 2014,'no comments')
    INSERT INTO Staging VALUES(444718562, 1003, '260518681','Mike Lira', 'Math','B', 2013,'no comments')
    CREATE TABLE Student(id INT,pn_id BIGINT,subject VARCHAR(100), [academic year] INT, grade VARCHAR(10), comments VARCHAR(100) )
    INSERT INTO Student VALUES(1001, '000616850', NULL,NULL,NULL ,NULL)
    INSERT INTO Student VALUES(1002, '002160790', NULL,NULL,NULL ,NULL)
    UPDATE Student SET Subject = C.Subject, [academic year]=C.[academic year], grade=C.grade,comments=C.comments
    FROM SSN A INNER JOIN Student B
    ON A.pn_id=B.pn_id INNER JOIN Staging C
    ON A.ssn = C.ssn
    SELECT * FROM Student
    Regards, RSingh

  • Triggers to insert the record in a table

    I have two table 1. Holiday 2. Attendance.
    When I insert the record    in holiday table for his
     advance holiday   with empid, the same time I want to insert it attendance table
     automatically for the same date using a trigger
    Insert into attendance (empid,date,holiday) values (20078,07/10/2014,1). If holiday column value 1 represent holiday marked,
     0 represent  holiday not marked. The same thing can happen vice versa
    If employee mark his current attendance as  holiday through attendance,
     it should   be  inserted into holiday table 
    automatically using triggers.
    Insert into  Holiday (empid,date,holiday) values (20078,06/08/2014,1). If holiday column value 1 represent holiday marked,
     0 represent  holiday not marked. The same thing can happen vice versa
    Please I am looking for your help , how I can make it using triggers 
    to insert both table  in two different ways of options.
    Regards
    Pol
    polachan

    Hi polachan,
    According to your description, if you want to synchronize the data between the holiday table and the attendance table while inserting records into holiday table, you need to create a trigger on the holiday table, please try the following syntax.
    use <databasename>
    go
    create trigger Tr_holiday
    on holiday
    for insert
    as
    declare @empid varchar(20),
    @date datetime,
    @holiday int
    select @empid = empid, @date=date, @holiday=holiday from inserted
    declare @qty int
    select @qty =count(*) from attendance where empid=@empid and date=@date and holiday=@holiday
    if @qty<1
    begin
    insert into attendance
    select i.empid,
    i.date,
    i.holiday
    from inserted i
    end
    Meanwhile, if you want to insert the record into the holiday table when holiday is updated to 1 in the attendance table, you need to create another trigger on the attendance table, please try the following syntax.
    use <databasename>
    go
    create trigger Tr_attendance
    on attendance
    for update
    as
    declare @holiday int
    if update (holiday)
    begin
    select @holiday=holiday from inserted
    if @holiday=1
    begin
    insert into dbo.holiday
    select empid,
    date,
    holiday
    from inserted
    end
    end
    For more details about creating triggers in SQL Server, please review this article:
    CREATE TRIGGER (Transact-SQL).
    Thanks,
    Lydia Zhang

  • How to refresh after delete the records in ALV report ?

    Hi Friends,
    How to refresh after delete the records in ALV report.
    I am deleting records in ALV report .
    After successful delete the screen should refresh.
    u201C Deleted records should not appear in the screen u201C.
    Please guide me.
    Regards,
    Subash

    Hi subhash,
    FORM user_command USING r_ucomm LIKE sy-ucomm      rs_selfield TYPE slis_selfield.
    WHEN 'BACK'.
    Refresh the internal table from the ALV grid
          PERFORM update_alv_tab.
    ENDFORM.                    "user_command
    FORM update_alv_tab .
      DATA :  e_grid TYPE REF TO cl_gui_alv_grid.
      CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
        IMPORTING
          e_grid = e_grid.
      CALL METHOD e_grid->check_changed_data.
      "update_alv_tab
      CALL METHOD e_grid->refresh_table_display.
    ENDFORM.                    " UPDATE_ALV_TAB
    Then see in Debug mode is it updating or not..
    Please confirm .
    And please paste the code if you can.
    Regards.

  • HT4623 How can i download ios 7.1 without using my iphone and itunes

    How can i download ios 7.1 without using my iphone and itunes

    If you don't use your phone and you don't use iTunes, what are you expecting to use? Your options to update your device are Over The Air through Settings>General>Software Update or by connecting the device to iTunes and updating.
    Best of luck.

  • I downloaded a song from i-tunes.  It plays on my computer, but won't play on my i-phone.  Any suggestions on how to fix this? Or how can I re-download the song without getting charged a second time.  I could not find an option to "report a problem".

    I downloaded a song from i-tunes.  It plays on my computer, but won't play on my i-phone.  Any suggestions on how to fix this? Or how can I re-download the song without getting charged a second time.  I could not find an option to "report a problem".

    I could not find an option to "report a problem".
    Log in to the Store. Click on "Account" in your Quick Links. When you're in your Account information screen, go down to Purchase History and click "See all".
    Find the item that is not playing properly. If you can't see "Report a Problem" next to the entry, click the "Report a problem" button. Now click the "Report a Problem" link next to the item.
    (Not entirely sure what happens after you click that link, but fingers crossed it should be relatively straightforward.)

Maybe you are looking for