script for del users

  • Hi All,

    when iam deleting the login ,automatically user also deleted in GUI....

    So I want t-sql script for automatically delete the user when i delete the login belongs to that user..

    Thanks to all...

  • This script should work just fine:

    You may want to modify it a little so it first checks if the user exists:

    drop Login [login_name]

    go

    sp_msforeachDB 'Use [?]; DROP USER [user_name];'

    QUIGROUP- Need a Certified experienced DBA for a project or troubleshooting? Need help with programming, database recovery, performance tuning, ETL, SSRS or developing new databases? Contact us.. 1-786-273-9809

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

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