How do I Encrypt a trigger in SQL Server 2000

  • Can anyone help me on how to Encrypt a trigger and possibly give me an example code on how to do it?

    Thank you

    Wayne


    Kindest Regards,

    Wayne Benhart

  • Wayne Benhart (2/1/2008)


    Can anyone help me on how to Encrypt a trigger and possibly give me an example code on how to do it?

    Thank you

    Wayne

    You could just use the "WITH ENCRYPTION" when you create the trigger. For example:

    CREATE TABLE mytable ( a INT )

    GO

    CREATE TRIGGER mytable_trigger ON mytable

    WITH ENCRYPTION

    AFTER INSERT

    AS

    PRINT 'hi'

    GO

    Note that the encryption on SQL Server 2000 is a joke, and many tools will happily decrypt these objects for you. SQL Server 2005 addresses this, and it is more difficult to decrypt these objects, but is still possible. So, while you will be able to hide the contents from the most basic users, you will also make your database more difficult to maintain.

    Regards,

    Andras


    Andras Belokosztolszki, MCPD, PhD
    GoldenGate Software

  • Andras Belokosztolszki (2/1/2008)


    You could just use the "WITH ENCRYPTION" when you create the trigger. For example:

    CREATE TABLE mytable ( a INT )

    GO

    CREATE TRIGGER mytable_trigger ON mytable

    WITH ENCRYPTION

    AFTER INSERT

    AS

    PRINT 'hi'

    GO

    OK, I've tried to put the 'WITH ENCRYPTION' in my create statement but I keep getting an error.

    Here is my statement... how would I add it to this create statement?

    CREATE TRIGGER [dbo.GLTRANSBATCH_Dept_Change_Ins] ON [dbo].[GLTRANSBATCH] FOR INSERT NOT FOR REPLICATION AS

    Thank you,

    Wayne


    Kindest Regards,

    Wayne Benhart

  • CREATE TRIGGER [dbo.GLTRANSBATCH_Dept_Change_Ins]

    ON [dbo].[GLTRANSBATCH]

    with encryption

    FOR INSERT NOT FOR REPLICATION AS

    -- your trigger logic...

    What error you have?

  • I tried it again and it workd fine... Not sure what I was doing different to cause the error.

    Thank you,

    Wayne


    Kindest Regards,

    Wayne Benhart

  • Thanx dear , it is good plateform for beginners

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

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