prevention of deteting data from a table

  • can somebody help me with a code that prevent data to be deleted from a table please

  • instead of trigger will do?

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

  • ... nothing or raise an error within the trigger to show the caller that something was wrong.

  • CREATE Trigger [dbo].[tr_UsrUsers_Audit] on [dbo].[USR_USERS] for insert, update, delete

    as.........

    Check BOL for a detailed explanation -but a Trigger is the way to go.

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    This thing is addressing problems that dont exist. Its solution-ism at its worst. We are dumbing down machines that are inherently superior. - Gilfoyle

  • CREATE TRIGGER prevent_delete ON yourtablecolumn INSTEAD OF DELETE

    AS

    BEGIN

    RAISERROR ('')

    END

    GO

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

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

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