i need to create a trigger that performs rollback

Rabia Kurnaz 386 Reputation points
2023-05-03T20:24:59.0833333+00:00

i need to create a trigger that performs rollback when user create and alter are made.

only sysadmin authorized people can create such

Azure SQL Database
SQL Server Other
{count} votes

2 answers

Sort by: Most helpful
  1. Erland Sommarskog 121.4K Reputation points MVP Volunteer Moderator
    2023-05-03T21:51:11.8333333+00:00

    I'm not sure that I agree with this requirement. Why rollback certain people's statements? Wouldn't it be better to not grant them permissions to create objects in the first place.

    Sure, you can implement the requirement with a DDL trigger, but I am not sure that this is the right solution.

    Can you give some background to why you want to do this?

    0 comments No comments

  2. Anonymous
    2023-05-04T01:50:26.7666667+00:00

    Hi @Rabia Kurnaz

    From your description, this is more like a permissions issue. We don't know what the point of doing so is.

    For reference, you can take a look at this official document.

    https://learn.microsoft.com/en-us/sql/relational-databases/triggers/logon-triggers?view=sql-server-ver16

    Best regards,

    Percy Tang

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.