Manage Learn to apply best practices and optimize your operations.

Top five T-SQL stored procedures

From finding columns and tables to executing code from a file, Brian Walker's top five stored procedures will offer the simple tricks you need to get routine tasks done.

T-SQL guru and senior database architect Brian Walker was generous enough to share his favorite and most useful...

SQL Server stored procedures over the past few months. His series has come to a conclusion, but we've got his "top five" according to your visits. We're sure these routines will help ease some of your workload. You can also view our complete stored procedure collection.

#1 - Find columns and tables
This simple routine is handy for finding columns by name and listing the table(s) in which they exist..

#2 - List database objects by selected type(s)
This stored procedure returns a list of all the objects of selected types in the current database.

#3 - A simple way to perform crosstab operations
SQL Server crosstab operations usually involve complicated T-SQL coding. Simplify the process with this routine.

#4 - Search character columns for a given string
This routine allows you to search for occurrences of a string in the character columns (char, nchar, varchar, nvarchar) of a table set.

#5 - Execute T-SQL code from a file
Existing routines to execute T-SQL code from a file without using osql and xp_cmdshell have many limitations. This routine addresses the shortcomings

More information from

  • RSS: Sign up for our SQL Server DBA or developer feeds to get new expert technical advice every week day
  • Glossary: SQL Server slang stumping you? Look it up in our glossary
  • Topics: Peruse our Topics section for help troubleshooting your SQL Server DBA, developer or management problems

  • Dig Deeper on SQL Server Database Modeling and Design