Category Archives: Security

How Do I Kill All Sessions from a Windows Group?

The stored procedure I am posting today will kill all sessions for users that are members of a given domain group. I use this stored procedure to keep ad-hoc (write down Access) users out of the way of nightly builds on my data warehouse. Continue reading

Posted in Security, User Management, Utilities | Tagged | Leave a comment

How Can I Tell if a Windows Login has Rights to My Server?

This is a great stored procedure to use for things like server dashboards where you only want people to see the dashboard for servers that they have access to without granting them all the rights that would go with the dashboard. Continue reading

Posted in Security, User Management, Utilities | Tagged | 5 Comments

Using sp_ExecuteSql to Run Dynamic SQL

Dynamic SQL should be considered a highly specialized tool of last resort and used properly. Misuse can lead to your server and the data stored on it no longer belonging to you. Continue reading

Posted in Dynamic SQL, Security | Tagged | Leave a comment

Stored Procedures to Store and Get Database Users with All Permissions

Introduction Traditionally when doing a restore, moving a database, etc. a DBA would simply go into Management Studio and use the Generate Scripts wizard to script all logins and permissions. This approach can take several minutes and as I recently … Continue reading

Posted in Security, User Management, Utilities | Tagged , , , , | 3 Comments