Skip to content

no an issue but a suggestion for - Security - Show Logins, Users, Schemas, and Jobs for Principal Name.sql #1

@JoyWorksToo

Description

@JoyWorksToo

Security - Show Logins, Users, Schemas, and Jobs for Principal Name.sql


DECLARE @username varchar(255); SET @username = '<username>';
DECLARE @ownerid uniqueidentifier; SET @ownerid = (SELECT UserID FROM Users WHERE UserName = @username)

BEGIN TRAN

  UPDATE Subscriptions SET ModifiedByID = OwnerID WHERE ModifiedByID = @ownerid
  DELETE FROM Subscriptions WHERE OwnerID = @ownerid
  DELETE FROM Schedule WHERE CreatedById = @ownerid 
  DELETE FROM PolicyUserRole WHERE UserID = @ownerid
  DELETE FROM Users WHERE UserID = @ownerid

COMMIT

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions