Category Script
TablesSQL Server Get constraints with definitions - List all constraints created in database tables including their definition.
T-SQL
development, integrity, MOC20762, MOC20764
TablesSQL Server Query partitions with boundaries - Check what partitions are you using in the database.
T-SQL
boundaries, MOC20762, MOC20764, partitioning
PerformanceSQL Server AdventureWorks heavy query I - Generate heavy load over AdventureWorks database.
T-SQL
AdventureWorks, MOC10987, MOC20764, query optimization, workload
DatabasesSQL Server Break database consistency - This is risky!
T-SQL
break database, datafiles, DBCC, issue, MOC20764
SecuritySQL Server Grant VIEW CHANGE TRACKING on tables - Generate script to grant permission quickly in more tables within database.
T-SQL
change tracking, MOC20761, MOC20764, tables
WaitsSQL Server Top waits - Identify top waits occurring in SQL Server.
T-SQL
MOC10987, optimization, performance, workload
MaintenanceSQL Server OH Index maintenance duration per index - Check which index's maintenance is taking most time.
T-SQL
MOC20764, Ola Hallengren, optimization, performance, workload
ConfigurationSQL Server Move TempDB files - Quick way to change tempdb files location.
T-SQL
data movement, MOC20764, tempdb
ConfigurationSQL Server Build number cut into parts - Identify build number of your SQL Server cut into parts.
T-SQL
build number, MOC20764, sql server
Execution plansSQL Server Execution count of stored procedures - Check what stored procedures are loading your SQL Server the most.
T-SQL
development, MOC10987, optimization, performance, workload
StatisticsSQL Server Database statistics information - Query information about statistics in current database.
T-SQL
MOC10987, optimization, performance, query estimation, query optimization, workload
Execution plansSQL Server Plan cache distribution per database - Check what database is using most of plan cache.
T-SQL
MOC10987, MOC20764, optimization, query estimation, workload
MemorySQL Server Memory usage by memory clerks - Look under hood and check what clerks are using memory.
T-SQL
MOC10987, MOC20764, performance, RAM, workload
MemorySQL Server Memory and page file usage - Check configuration and usage of RAM and page file.
T-SQL
MOC10987, MOC20764, performance, RAM, workload
QueriesSQL Server Get query completion – detailed - Retrieve information about query completion percent and estimated finish time.
T-SQL
MOC20764, performance, query estimation
QueriesSQL Server Get query completion – simple - Retrieve information about query completion percent and estimated finish time.
T-SQL
MOC20764, performance, query estimation
SecuritySQL Server Check if login exists (SQL Server 2000) - Verify if required login exists in SQL Server 2000 instance and affect workflow.
T-SQL
MOC20764
SecuritySQL Server Check if login exists - Verify if required login exists and affect workflow.
T-SQL
MOC20764
SecurityWordPress Create admin account - Simply create new account directly in WordPress database.
MySQL
admin, automation, phpMyAdmin
MemorySQL Server Buffer pool usage - Check buffer pool usage for every database.
T-SQL
buffer pool, moc, MOC10987, MOC20764, RAM
MemorySQL Server Buffer pool pages distribution - Check page count stored in buffer pool for every database.
T-SQL
buffer pool, MOC10987, MOC20764, page, performance, RAM
Execution plansSQL Server Force parameterization for query plan - Let your SQL Server know what query to parameterize if beneficial.
T-SQL
MOC10987, plan guide, query estimation, query optimization
Execution plansSQL Server Single use execution plans - Get execution plans that were used only once.
T-SQL
memory bloat, MOC10987, plan cache, query optimization
Execution plansSQL Server Get queries with same plan - Analyze plan cache for multiple use of plan by same query.
T-SQL
MOC10987, query estimation, query hash, query optimization
DatabasesSQL Server Shrink log for all user databases - Bulk shrink of transaction log for all databases.
T-SQL
bulk, MOC20764, optimization, shrink, transaction log
DatabasesSQL Server Data files latency - Examine performance of particular data files for all databases.
T-SQL
disk drives, latency, MOC10987, performance
TablesSQL Server Generate persons test data - Quickly generate some persons data using popular AdventureWorks database sample.
T-SQL
AdventureWorks, cross, data, generate, join, MOC20761
Execution plansSQL Server Get cached execution plans - Look into your cache and see what execution plans live there.
T-SQL
MOC10987, performance, query estimation, query optimization, tunning
SecuritySQL Server Add database role(s) in multiple databases - Add login to same database roles in multiple databases can be time consuming.
T-SQL
automation, database roles, login, MOC20764, sp_MSforeachdb
SQL AgentSQL Server Jobs overview - Quick overview of all SQL Agent jobs.
T-SQL
automation, job, maintenance, MOC20764, schedule
BackupDisaster recovery Identify missing backups - Quick check if all your databases are backed up.
T-SQL
backup retention, MOC20764, multiquery
BackupDisaster recovery Get backup by LSN - Find backup to complete your restore operation with missing LSN.
T-SQL
backup chain, LSN, MOC20764
ConfigurationSQL Server TempDB configuration check - TempDB is heavily used database in every instance, time to check it.
T-SQL
CPU, datafiles, MAXDOP, MOC20764, optimization, tempdb
DatabasesSQL Server Datafile auto-growth events - Looks for auto-growth events in default SQL Server trace.
T-SQL
data sizing, datafiles, disk drives, MOC20764, volumes
DatabasesSQL Server Set simple recovery model - Switch recovery model to SIMPLE for all databases in loop.
T-SQL
MOC20764
AlwaysOnSQL Server Is database part of an Availability Group? - Check databases membership in Availability Groups.
T-SQL
availability group, listener, MOC20764, replica
DatabasesSQL Server Set Single-User mode - Set database to SINGLE_USER mode do something and set MULTI_USER mode.
T-SQL
ALTER, MOC20764, multi_user, single_user
DatabasesSQL Server Set Read-Only mode - Set database to read only mode do something and set read write mode.
T-SQL
ALTER, MOC20764, no_wait, read-only, read-write
DatabasesSQL Server Set multiple database mode - Generate script for changing mode for multiple databases.
T-SQL
IMMEDIATE, MOC20764, multi-user, read-only, ROLLBACK
StatisticsSQL Server Update statistics for all databases - Easily update statistics with one line function.
T-SQL
MOC10987, MOC20764, optimization, performance, resample, stats
IndexesSQL Server Index usage - Check how are your indexes doing in the database.
T-SQL
b-tree, clustered, MOC10987, MOC20764, nonclustered, scans, seeks, updates
IndexesSQL Server Index list - Get information about all existing indexes in given database.
T-SQL
index, MOC10987, MOC20764, optimization
DatabasesSQL Server Collect DBCC CHECKDB results - Get more more handful information about corrupted database.
T-SQL
consistency, DBCC, integrity, MOC20764, restore
DatabasesSQL Server Search for value - You want to find some value within whole database, in all tables and columns?
T-SQL
columns, MOC20761, search, tables
Disk drivesHost server Disk drives size - Returns information about space on disk drives used by databases in instance.
T-SQL
disk drives, MOC20764, volumes
DatabasesSQL Server Size of each database - Returns size of all databases all database files with its location and state.
T-SQL
data sizing, datafiles, MOC20764
DatabasesSQL Server Size summary - Returns summary of all data within SQL Server instance grouped by type.
T-SQL
data sizing, datafiles, MOC20764, tempdb
DatabasesSQL Server Last schema changes - Shows information about schema changes done in databases by DDL operations.
T-SQL
datafiles, DDL, MOC20764, schema changes
DatabasesSQL Server Batch database drop - You need to drop more databases quickly.
T-SQL
cleanup, cursor, drop database, MOC20764, remove database
AlwaysOnSQL Server Check actual replica - You want to execute script against database only if actual database is primary replica?
T-SQL
automation, availability group, MOC20764, replica, sql server
AlwaysOnSQL Server Suspend & resume data movement - Sometimes you need to reinitialize data movement in Availability Group.
T-SQL
availability group, data movement, MOC20764, sql server, synchronization
BackupDisaster recovery Backup locations - Returns list of backups created over all databases, with location, timings and size information.
T-SQL
backup, MOC20764, recovery, restore
AlwaysOnSQL Server Connectivity issues - Return actual state of local replica connectivity to other replicas in Availability Group.
T-SQL
availability group, connectivity, MOC20764, replica

Unfortunately nothing found

Sorry, I couldn't find any script related to your search

I can't help you with your issue now, but if you will be successfull and want to share some script which helped you, use contact channels and your script can be there filling this empty results.

Would be nice, what do you think?

There are 53 scripts published! And still growing...
 
Scripting library is some place, where you can find some useful script that can help you. Every script including description of results and more.  Do you like scripting? Lets check it out!
 

Motivation

Every day I’m using some scripts to make life simpler, to avoid repeating actions or to have some fun. During the years I’ve collected many scripts (most of them are T-SQL). I kept them in OneNote document.
 
I was frequently asked to provide them to the colleagues, students, mates and so on. Finally I decided to make them available online. I created some kind of library with search and filtering options.
 
Most scripts you can find there are from internet forums or books. During the years I was not collecting all the information. Authors of the script so sorry if you find your script here without linking your page. Let me know and I will fix it immediately. Some of the script are written by me so it includes longer description or blog post.
 
If you want to add some your stuff, no problem. Let me know and we can help DBAs, developers, administrators or students. Everybody likes to save some time on daily routines.

 

 

 

If you want to be informed about new scripts published, you can subscribe to our newsletter. You will receive notifications about newly published script immediately. 

Want to recieve notification when new scripts published?
Loading

Thank you for your interest!

So just few instructions how to use this library, it was designed to be intuitive but get this help article handy only for first use, but trust me it is nothing special to work with.

Help content

Searching

The main idea is to find script you are looking for am I right? Just use search field for whatever you look for and if you are lucky table will contain some useful scripts for your problem.

Showcase of searching using main search field

Filtering

If you want to shorten focus of scripts listed to your problem you can use advanced filtering, what you can see there depends on actual version and maybe actually there are more filtering options than in below video guide.

Showcase of using advanced filtering

TIP: You can use shortcut to filter by category when clicking category in table, only thing that happen is to use advanced filtering and filter by clicked category – so it is only shortcut 🙂

 

Script details

Once you will find script that should fit your search you can click its name to open modal with its details divided in tabs, copy its body or open its body in new window with raw text.

Showcase of opening script details dialog

 

Script body

You can use shortcut to open just script body which you can directly copy and paste where do you need. You can go to script details directly from this dialog using details link in right bottom modal footer.

Showcase of opening script body shortcut

TIP: You can use link to open script details in separate window where you can find discussion and ask some questions or provide your opinion. Click orange “Discussion” button on top right, this will bring you new browser tab with script page. On the separate script page, you can leave comments. I will see how it goes with comments and will bring them somewhere handy in the future if needed.

Script in separate tab shortcut

 

More ideas

If you have some idea how to make this library more efficient and user friendly I will be glad if you share your ideas with me and I will try to do my best to make it happen. Feel free to contact me if you have any questions or anything. Thank you for visiting.