How to Track the table using Trigger or any other Object

Hi Folks
I need to audit Inserts, deletions, updates  to inserted into other tracking table. I was planning on using a trigger to do this,
Can you please help me how can I wright code for trigger for this. or else using any other object we can do this operation.
can you please help me thanks in advance.
Thank in advance.

Also you can use an OUTPUT clause ( need to modify your DML operations)
create table itest ( i int identity not null primary key, j int not null unique )
create table #new ( i int not null, j int not null)
insert into itest (j)
output inserted.i, inserted.j into #new
select o.object_id from sys.objects as o
select * from #new
drop table #new, itest;
go
The example below shows code that uses OUTPUT clause in UPDATE and DELETE statements to insert rows into an audit table.
create table t ( i int not null );
create table t_audit ( old_i int not null, new_i int null );
insert into t (i) values( 1 );
insert into t (i) values( 2 );
update t
   set i  = i + 1
output deleted.i, inserted.i into t_audit
 where i = 1;
delete from t
output deleted.i, NULL into t_audit
 where i = 2;
select * from t;
select * from t_audit;
drop table t, t_audit;
go
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

Similar Messages

  • How to see the Table Names & Field Names by other than F1 help

    Hi Experts
       How to see the Table Names & Field Names by other than F1 help, & How to see the List of MM Table Names.
    Rgds

    The only option to see the active table/ field name is through F1 --> Technical Information. Apart from this, you can use any 3rd part application like GUIex (INbuilt in SAP ECC 6.0 ... can be activated by clicking on the tri-color button on the top right), but you need technical knowledge to understand the information. As far consolidated list of MM tables is concerned, SAP don;t provide you the same at one place, it experience and knowledge which help you in this regard. For your immediate reference MM tables are as under :
    EBAN  - Purchase Requisition 
    EBKN  - Purchase Requisition Account Assignment 
    EBUB   - Index for Stock Transport Requisitions for Materi
    EINA    - Purchasing Info Record: General Data 
    EINE     - Purchasing Info Record: Purchasing Organization D
    EIPA     - Order Price History: Info Record 
    EKAB   - Release Documentation 
    EKAN   - Vendor Address: Purchasing Document 
    EKBE    - History per Purchasing Document 
    EKBEH - Removed PO History Records 
    EKBZ    - History per Purchasing Document: Delivery Costs 
    EKBZH  - History per Purchasing Document: Delivery Costs 
    EKEH    - Scheduling Agreement Release Documentation 
    EKEK    - Header Data for Scheduling Agreement Releases 
    EKES     - Vendor Confirmations 
    EKET     - Scheduling Agreement Schedule Lines 
    EKETH   - Scheduling Agreement Schedules: History Tables 
    EKKI      - Purchasing Condition Index 
    EKKN    - Account Assignment in Purchasing Document 
    EKKO    - Purchasing Document Header 
    EKPA     - Partner Roles in Purchasing 
    EKPB     - "Material Provided" Item in Purchasing Document 
    EKPO    - Purchasing Document Item 
    EKPV    - Shipping-Specific Data on Stock Tfr. for Purch. D 
    EKRS    - ERS Procedure: Goods (Merchandise) Movements to b 
    EKUB    - Index for Stock Transport Orders for Material 
    EORD    - Purchasing Source List 
    EQUK    - Quota File: Header

  • How to get the extension Info from firefox? Do we have any firefox API to communicate with the browser? I couldnt see the HTML of the widget displayed in the toolbar how to access the widget using JS or any way

    How to get the extension Info from firefox? Do we have any firefox API to communicate with the browser? I couldnt see the HTML of the widget displayed in the toolbar how to access the widget using JS or any way

    Hi,
    Thanks for the suggestion. I've been playing around with some of the classes of the java.net package and java.io
    Using the URL class i can get the content of the data from a STATIC page and output that response to file so that is does not display to the client broswer.
    But this only works if the URL i give points to a static html page.
    So the problem i'm getting is if i'm righting in arguments in the URL, this means that server needs to process the arguments i give and its sends back a dynamic result. Because its dynamic the URL class can not handle this and throws me an exception everytime :(
    Have u ever tried to do some things like this?
    Rahul

  • How to know the tables used in an Extractor?

    Hi Friends,
    Is there any method to find out the underlying tables used in an extractor?
    For example , 2LIS_11_VAITEM datasource uses tables  VBAP and VBUP( item status). For LOs we can see it in Lo **** pit. So If any extractor uses more than one table ..then how do you see those?? . If it is generic ds which is based on Functional Module, then what is the procedure other going into table tab.
    Actuall i would like to know for DS of FICA Open items 0FC_OP_01 .
    Thank in advanace
    Murthy

    Hi If it is LO extractor:
    Use transaction code LBWE  in the R/3
    Go to the extractor for which you want to see the data( Logistic app->Extractors)
    Go to maintenance
    You will get an option to update just click yes and then you will get option to create request.Just check the display, it will lead you  top the window where you can see where all the fields are and from which table it is available.
    check the Roberto's blog:
    /people/sap.user72/blog/2005/09/05/sap-bw-and-business-content-datasources-in-pursuit-of-the-origins

  • How to track the CqPage using stats.jsp

    Hi,
    I have added the  stats.jsp in the head of the template
    <cq:include script="/libs/foundation/components/page/stats.jsp" />
    but how can i track the page viewed ?
    Thanks in advance
    Sumit

    Hi,
    You can see the impressions on CQ console but just gives you the count and i think there is no OOTB tool available.  So if you want to take look into complete report then probably you have to write your own custom tool using CQ API
    final PageViewStatistics pwSvc = sling.getService(PageViewStatistics.class);
    pwSvc.report(page);
    some other page related report but not similar can find - http://<host>:<port>/etc/reports/auditreport.html
    Thanks,
    Pawan

  • How to know the tables used in a program?

    Hi,
    Please tell me, how to know all the tables that have been used in a program?

    Hello Vijay
    Have you had a look at fm RS_PROGRAM_TABLES already?
    See also tables from prog
    Regards
      Uwe

  • How to populate the table using webservice

    Hi,
    i have created the web service from function module and  integrated this web service in interactive form using New data connection.
    I have drag and drop all field into the form table and test the form,but its not populate table.
    if any script need for this,
    Kindly explain in detail or give the sample code.
    Thanks in advance
    Parthasarathi

    Dear folks
    M about to create a midlet
    application in which i need to populate my table
    with the current stock exchange values. Since these
    values get changed dynamically , I planned to use
    streaming. Since m new to streaming ,pls someone
    come up to guide me in right path. M using Canvas
    application. I appreciate all the repliesthats fine and funny....
    let me tell you something, in GCF everything you fetch through GPRS is bound to come as an inputstream and whatever request you send is passed as outputstream. so if you have worked with GCF, you have worked with streaming already. isn't it.
    SD

  • How to populate the table using streaming data

    Dear folks
    M about to create a midlet application in which i need to populate my table with the current stock exchange values. Since these values get changed dynamically , I planned to use streaming. Since m new to streaming ,pls someone come up to guide me in right path. M using Canvas application. I appreciate all the replies

    Dear folks
    M about to create a midlet
    application in which i need to populate my table
    with the current stock exchange values. Since these
    values get changed dynamically , I planned to use
    streaming. Since m new to streaming ,pls someone
    come up to guide me in right path. M using Canvas
    application. I appreciate all the repliesthats fine and funny....
    let me tell you something, in GCF everything you fetch through GPRS is bound to come as an inputstream and whatever request you send is passed as outputstream. so if you have worked with GCF, you have worked with streaming already. isn't it.
    SD

  • PM: how to track the operations in prev.maint order against object list

    Dear PM Guru's.
    i have one issue in my preventive maintenance scenario. i clubed the same type of machines in one maintenance order under object list tab. and i mention the list operations in maintenance order. suppose in one preventive maintenance order 10 operations are maintained and 5objects are mentioned in that order. Now i like to mention all these 10 operations activities against to 5 objects. how i can assign sequentially? i required like 10operations one by one row wise and 5objects side by side column wise. i would like to update the each operation activity against each machine column? how i have to do this one?
    Please suggest me and help me.
    regards
    Jalendhar Merugu

    Using Object functionality, we can maintain many equipments in the order.
    But the constraint is that one operation can be assigned to only one equipment. In your case, you have 5 objects. If all 10 operations will be performed on 5 objects, then you have to maintain 50 operations & you should assign the objects.
    In other words, if one operation will be performed on 5 objects, then you should define that one operation 5 times & you have to assign to technical objects. You can't share one operation to many equipments.

  • How to search for folders using jsp ( or any other way)?

    Hey All,
    It's my first time writing here and i hope i can get some help ... i have created a payroll system using java and jsp techniques and mysql as the database, i want to create a backup page that will let the use to choose the destination folder for the back up, the backup is basically a mysqldump command that will get the destination folder as an argument and create the sql file there. the problem is i couldn't find anyway to let the user browse his local machine and choose the folder , which in returns return the folder path to be used in mysqldump....
    I know that html have <input type=file> but it's used for selecting file not folder...
    can someone come up with a solution for me coz it's urgent and i have to finish the project by the end of this week.,.
    peace!

    Also you can use an OUTPUT clause ( need to modify your DML operations)
    create table itest ( i int identity not null primary key, j int not null unique )
    create table #new ( i int not null, j int not null)
    insert into itest (j)
    output inserted.i, inserted.j into #new
    select o.object_id from sys.objects as o
    select * from #new
    drop table #new, itest;
    go
    The example below shows code that uses OUTPUT clause in UPDATE and DELETE statements to insert rows into an audit table.
    create table t ( i int not null );
    create table t_audit ( old_i int not null, new_i int null );
    insert into t (i) values( 1 );
    insert into t (i) values( 2 );
    update t
       set i  = i + 1
    output deleted.i, inserted.i into t_audit
     where i = 1;
    delete from t
    output deleted.i, NULL into t_audit
     where i = 2;
    select * from t;
    select * from t_audit;
    drop table t, t_audit;
    go
    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

  • How to tracke the new entries in database table ?

    Hi,
    How to tracke the new entries in database table ? is there any FM or report is there to check it ?
    regards
    vishnu

    Hi Vishnu,
    u can write a report program for this and in that use the event  :
    AT NEW <field-name> ( use primary key)
    your statements
    ENDAT
    for eg.
    loop at itab ( herfe itab must be of type of table for which u want to track new entries)
    at new matnr
    write:/ new record
    endat
    endloop.
    schedule this report in background to run in every 5 or 10 mins as per your requirement and hence changes can be tracked.
    regards
    Vinod

  • How to track the history of supplier sites used for tax reporting (1099)

    Hi,
    Oracle financials doesn't allow two supplier sites setup as tax reportable sites (Unless one is inactive). Suppose if the supplier uses site1 for the year 2009 and site 2 for 2010 and now there is site3 setup as tax reportable. All three sites were setup in 2009 and all three sites are active. Supplier chosen different sites for each year as their tax reportable site.
    How do we know which site oracle used to send 1099 for 2009 & 2010? How to track the history of supplier sites used for tax reporting (1099) in previous years?
    Thanks in advance.
    Regards,
    Ram

    Would the begin_date, end_date and status columns on HZ_PARTY_SITES_USES be any good? Our R12 installations is too new to have accumulated much data yet, but I would look in those columns first.

  • How to fetch what are all the tables used in this TR no and Package name of

    Hi Friends,
    I have input of Transport Request no (E070-TRKORR).
    How to fetch what are all the tables used in this TR no and Package name of this Table.

    HI,
    FYI
    SELECT E071OBJECT_NAME, E070MDEVCLASS
    FROM E071, E070M
    WHERE TRKORR = YOU REQUEST NO.

  • How to find out the script for the table using SQL

    Hi,
    Could any one tell me that how to find out the script for the table using SQL.
    Thanks,
    kamal

    Kamal,
    You can find the SQL query in Advanced tab of Answers
    Thanks,
    Balaa...

  • How do I rename the table using Impdp?

    Using the Impdp/Expdp utility of Oracle, I am trying to import a table. However the target database contains a table with the same name. How do I rename the table using Import?
    REgards,
    Sakthi

    SAKTHIVEL wrote:
    Using the Impdp/Expdp utility of Oracle, I am trying to import a table. However the target database contains a table with the same name. How do I rename the table using Import?
    Hmm well why you just can't rename the table on the target db with the rename table to command and then do the import, will be easy right?
    Aman....

Maybe you are looking for

  • Could not complete your request because of a program error~CS4

    What is happening: I open photoshop, I then try to create a canvas or load a file dosnt matter what I try to do as long as im trying to do a new project, I click ok in both of them then I get the error, when I click OK I get photoshop CS4 has stopped

  • How to Reply to a Mail Using Javamail?

    Hi Friends, My Requirement is to reply to a email came froom sender mail. and i want to send a reply email to my sender using JavaMail program. I was sucessful in sending mails with attachments and i can retrive plain mails i mean text mails,with att

  • Applicatio​n Builder Performanc​e?

    Hello all. Can anyone tell me if putting your application through the Application Builder has a real improvment on performance. Or does it just cut the size of the exe. down? Regards, Steve Drake

  • Only the top row of buttons works on the aluminun wireless keyboard

    After returning my first wireless keyboard for not pairing with my iMac (which has all the right tech specs) I exchanged it for a new one. Initially, I was able to type letters and numbers only and many of the keys were not doing the task they were s

  • Kernel Panic, Keeps happening, please help me.

    Everytime i close my macbook pro and let it set for a while, when i open it up, it takes me to the restart screen because of a kernel panic. Someone, or Apple, PLEASE help. Information is below KERNEL PANIC INFO: Interval Since Last Panic Report:  12