HELP ME

  • Dear All,

    I need to fetch the values from database table ,like when update, delete,or

    insert happening. If we using trigger we can do only for particular table,

    but i need entire database

    Reply early..

  • saravanantvr1984 (3/2/2009)


    I need to fetch the values from database table ,like when update, delete,or

    insert happening. If we using trigger we can do only for particular table,

    but i need entire database

    Fetch to where, from where, when what happens.

    Explain your problem in more detail please

    Reply early..

    Is that a request or a command?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • I believe the question is how to capture/audit all rows from all tables anytime any of them suffers an insert/update/delete.

    And, I agree... it's either the language barrier getting to me or this sounds a bit demanding.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • I have to agree with both of you, little bit demanding. I'd say that Jeff is also correct in that the OP wants to audit all INSERT/UPDATE/DELETE activity on all the tables in the database.

    Depending on the number of tables, that could be a fair amount of work setting up auditing. I think they should focus first on the core tables first, what ever they are.

  • you better need to write ur own logic for that

  • If you really want to do this then I think the only way is to put the work in and create an "audit" or "history" table for each "primary" table, and then write a separate trigger for each primary table that will write to the respective history table. And don't worry about sounding demanding - I'll always give you the benefit of the doubt if English isn't your first language.

    John

  • There are two ways to approach this. The first is brute force creating each audit or history table and the triggers needed to populate them. The second is to figure out how to do it via SQL scripts. You can use the system views sys.tables, sys.columns, sys.types to help you create dynamic sql scripts to build the audit/history tables and the appropriate triggers. May take more effort up front, but once done, the heavy work is done.

  • John Mitchell (3/4/2009)


    And don't worry about sounding demanding - I'll always give you the benefit of the doubt if English isn't your first language.

    Good... you can have them all... I prefer proper manners even from ESL's. It's the first thing you should learn when venturing outside your native tongue.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • If you really need all all inserts, updates, and deletes on all tables, perhaps you should look into using a third party transaction log reader. Of course this means you have to keep backups of your transaction logs. We used to have triggers on our sensitive tables to log the changes. It was a lot of work, and a lot of data in the change log for something we used very little. Now, on the rare occasion that we have to find out what was changed and/or who changed the data, we use a product called Lumingent Log Explorer. I am sure there are other similar products out there as well. This approach has solved the issue for us.

    Thanks

    Todd P Payne

  • Hi

    As first:

    Sorry for a partial answer to the question :D. I also do not like those kind of wording.

    As second:

    Sounds that you want to trace information. Maybe have a look at the SQL Profiler. For any further information about it, post less command-style questions here. 😉

    Greets

    Flo

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply