Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2007
    Posts
    8

    Unanswered: passing tablename to proc from trigger

    --------------------------------------------------------------------------------

    I want to fire a trigger which calls a stored proc, passing the name of the table the trigger is defined on to the proc without having to hardcode.

    Can it be done ?

    trigger x on table y
    for update
    as
    declare @table_name
    select @table_name = get underlying table_name 'y' from somewhere
    exec stored proc (@table_name)

    where do I find the name of the table the current trigger is defined on ?

    thanks

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    I want to make a birthday cake out of nitroglycerin.
    Sometimes the question is not "can it be done", but "should it be done".
    Don't put this kind of crap in a trigger.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Why don't you tell us what your trying to acccomplish instead of trying to force a technical solution that doesn't seem to be a "best practice" kind of thing

    Blind dude, did they base rat on you?
    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.

  4. #4
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Huh? Rat? Base? Huh?
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

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