Free Tools for DBAs and Developers

Tools for comparing databases, tables, finding unused indexes, manipulating strings, performance tuning, converting data, and so much more.

And did we mention, free?

(Latest release v6.0 October 2017)

What are the SDU Tools?

SDU Tools is an easy to use toolkit. You just run a single script to install it in any database. Each release completely replaces all contents of the SDU_Tools schema. It contains utility functions and procedures. Many of the functions are useful when performing troubleshooting but others are just general purpose functions. This toolkit is updated every month.

Find the latest version or sign up to be notified of updates right here, and for suggestions or bug reports, please email sdutools @

To see how any of the tools work, click the name or description of the tool for a short video presentation

General Functions
ProperCaseConverts a string to Proper Case
TitleCaseConverts a string to Title Case
CamelCaseConverts a string to camelCase
PascalCaseConverts a string to PascalCase
SnakeCaseConverts a string to snake_case
KebabCaseConverts a string to Kebab-Case
PercentEncodeEncodes reserved characters that are used in HTML or URL encoding
AsciiOnlyRemoves non-ASCII characters from a string
DigitsOnlyRemoves non-digit characters from a string
QuoteStringQuotes a string
LeftPadLeft pads a string
RightPadRight pads a string
SeparateByCaseInserts spaces in Pascal-cased or camel-cased strings
SplitDelimitedStringSplits a delimited string (usually either a CSV or TSV) into rows
SplitDelimitedStringIntoColumnsSplits a delimited string (usually either a CSV or TSV) into columns
TrimWhitespaceRemoves any leading or trailing space, tab, carriage return, and linefeed characters
StartOfFinancialYearCalculates the date for the start of the financial year
EndOfFinancialYearCalculates the date for the end of the financial year
IsLeapYearDetermines if a year is a leap year
CountWordsCounts the number of words in a string
InvertStringReturns an upside down version of the string
SleepSleeps for a number of seconds
TranslateReplaces a set of characters in a string
DateDiffNoWeekendCalculates the number of days between two dates excluding weekends (Saturday and Sunday)
XMLEncodeStringPerforms XML encoding on a string
XMLDecodeStringDecodes an XML encoded string
PrintMessagePrints a message immediately (unlike PRINT)
DropTemporaryTableIfExistsDrops a temporary table if it exists
PreviousNonWhitespaceCharacterFinds the previous non-whitespace character working backwards from the current position
Database Utilities
AnalyzeTableColumnsProvides metadata for a table's columns and a sample of distinct column values
FindStringWithinADatabaseFinds a string anywhere within a database. Can be useful for testing masking of sensitive data. Checks all string type columns and XML columns
FindSubsetIndexesFinds indexes that appear to be subsets of other indexes in all databases or selected databases

A distinct list of each data type (and size) used with the selected database
ListColumnsAndDataTypesLists all columns and their data types for a database
ListForeignKeysLists foreign keys and their columns as column sets
ListForeignKeyColumnsLists foreign keys and their columns as rows
ListNonIndexedForeignKeysLists foreign keys not supported by indexes
ListIndexesLists indexes with key column lists and include column lists
ListUnusedIndexesLists unused indexes for a database
ListMismatchedDatabaseCollationsList databases with collations that do not match the server
ListMismatchedDataTypesList columns with the same name that are defined differently
ListPotentialDateColumnsList columns named as dates but actually datetime or datetime2
ListPotentialDateColumnsByValueList columns defined as dates but not containing time values
ListUseOfDeprecatedDataTypesLists all columns and their data types for a database where the data type is deprecated
ListUserTableSizesLists row counts and sizes for user tables
ListUserTableAndIndexSizesLists row counts and sizes for user tables and indexes
ReadCSVFileReads columns from a CSV file
EmptySchemaRemoves all user objects from the selected schema
IsXActAbortONDetermines if XACT_ABORT is currently on
ShowBackupCompletionEstimatesShow the status of currently-executing backups and estimate the completion time
ShowCurrentBlockingLists sessions (and their last queries) for all sessions holding locks, then lists blocked sessions, with the queries they are trying to execute, and which sessions are blocking them
ExecuteJobAndWaitForCompletionExecutes a SQL Server Agent job synchronously (waits for it to complete)
ClearServiceBrokerTransmissionQueueClears service broker transmission queue entries and conversations
UpdateStatisticsUpdates statistics on a set of tables and or schemas or a complete database


Note that string manipulation in T-SQL is relatively slow. Many of these functions would be much faster as SQLCLR based implementations but not all systems have SQLCLR integration enabled. To make them work wherever possible, all of these functions are written in pure T-SQL. We also don't assume that you're using the latest version of SQL Server, so the functions are written to work on all currently-supported versions.

The Fine Print (Disclaimer and License)

We try our hardest to make these tools as useful and bug free as possible, but like any software, we can never guarantee that there won't be any issues. We hope you'll decide to use the tools but all liability for using them is with you, not us. You are free to use the tools in this collection as long as you keep them in the SDU_Tools schema as a single set of tools, and as long as this notice is kept in any script file copies of the tools. We don't want lots of different versions of them out in the wild and would prefer them to stay in a single small schema that's easy to upgrade. They can be used privately or commercially. You may not repurpose them, redistribute, or resell them.