This is the download page, where I’ve collected large scripts that aren’t practical to post in their entirety into a post, as well as other downloads. I’ve made an honest effort to test and verify them all, but bear in mind that I don’t have access to every type of advanced system setup and environment, so some of them may not work as planned on your particular server.
These are scripts I’ve put a lot of work into, and/or that I frequently use myself.
SQL Server calendar functions
View active SQL Server sessions and locks
A heavy-weight interpretation of sp_whoisactive. Github.
Synchronizing logins between servers
A stored procedure to fetch logins and user-defined server roles from another server (like a primary AG replica) and sync them to the local instance. Blog post, Github, and how to do it with dbaTools instead.
Gists and other hacks
These are nice-to-have scripts and hacks that you may find useful. Typically built for a single use-case and not as thoroughly tested.
- Decrypting SQL Server objects. Blog post, Gist.
- Generate a list of recurring dates. Blog post, Github.
- Load an XML blob into one or more tables. Blog post, Gist.
- Visual representation of SQL Server Agent job schedules. Blog post, Gist.
- Script to identify potential primary key candidates. Blog post, Gist.
- A simple template parser for T-SQL: Blog post, Gist.
General disclaimer and copyright notice
These are scripts that I’ve written and made available to you under the condition that you take responsibility for any consequences that may arise from using them. I do not recommend running them directly in production-like environments without thorough testing.
I cannot assume any responsibility regarding the accuracy of any output information, performance impacts on your server, whether the code performs correctly in your environment or any other consequences of using these downloads. It’s free, so it’s your ass. If your jurisdiction does not allow for this kind of waiver/disclaimer, or if you do not accept these terms, you are NOT allowed to store, distribute or use this code in any manner.
These documents are made available under the Creative Commons 4.0 (with attribution) license. In short, this allows you to freely use, modify and redistribute them without charge, though you have to quote the source (the URL of this blog, https://sqlsunday.com/, is fine).