Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2004
    Posts
    7

    Question Unanswered: sql command executing trigger

    hi.
    I must get i trigger the sql command, which execute trigger.

  2. #2
    Join Date
    Oct 2001
    Location
    Naples, FL
    Posts
    273
    Are you asking:

    How to create a trigger? - If so, look in BOL under create trigger

    How to find the trigger code? - in EM, right-click the table, all tasks and choose manage triggers, then pick from the drop down

    How to find out what statement is making the trigger run? - Use profiler to capture the appropriate events.

    HTH
    ---------------
    Ray Higdon MCSE, MCDBA, CCNA

  3. #3
    Join Date
    Jan 2004
    Posts
    7
    I am asking: How to find out what statement is making the trigger run? and you tell me : Use profiler to capture the appropriate events.
    but a must get this information in trigger code

    Originally posted by rhigdon
    Are you asking:

    How to create a trigger? - If so, look in BOL under create trigger

    How to find the trigger code? - in EM, right-click the table, all tasks and choose manage triggers, then pick from the drop down

    How to find out what statement is making the trigger run? - Use profiler to capture the appropriate events.

    HTH

  4. #4
    Join Date
    Oct 2001
    Location
    Naples, FL
    Posts
    273
    If you wanted to capture the user you could buils suser_sname() into your trigger, if you wanted the machine you could use host_name(), the date getdate(), if you want the full script that was used, I'm not sure how you would do that and just thinking about parsing that later makes me cringe, what INFO is it you need to capture?
    ---------------
    Ray Higdon MCSE, MCDBA, CCNA

  5. #5
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Do you want to just know that it was an insert, update or a delete?

    If that's all, check for the existance of rows in inserted and deleted...

    If you want to know the exact statement...you'd have to code for that..and if you had to do that, you wouldn't need it in the trigger...
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  6. #6
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •