Triggers

  • you are defining a delete trigget on a table in which you want to delete the entries of the same table depeneding on the primary key value

    its generating the lock error on mysql in stored function/trigger because it is already used by statement which invoked this stored function/trigger.

    how u implement that on sql server?

    Please suggest me some solution

  • Are you referring to nested triggers?

    code will help

  • I mean, can we use table's primary key as delete trigger id for the same table.

    eg. I have table ABC and created a delete trigger. table has primary key... 1,2,3,4, and so on..

    now, I have fired the delete trigger with id=2 to delete 2nd row from the same table ABC. can it be possible.

    Thanks

  • the primary key constraint reqiures values to be unique, by deleting a value, you are still satisfying that reqiurement.

    i dont see why you can't

  • Perhaps if you read the first article linked in my signature and posted according to those suggestions you might get better, more complete answers.

    In SQL Server, by default, a trigger fires AFTER an action so by defining a DELETE trigger you are saying do X AFTER a delete has occurred. So, in your case I have to ask, are you deleting a second row AFTER the initial delete? If so, how are you determining what the second row is?

    Here's a link[/url] to an article that presents trigger basics for SQL Server

Viewing 5 posts - 1 through 5 (of 5 total)

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