Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin.
Search for scripts directly from SSMS, and instantly access any saved scripts in your
SSC briefcase from the favorites tab.
Download now (direct download link)
Thank this author by sharing:
By Jesse Roberge,
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=Util_TableSearch Mk2By Jesse Roberge - YeshuaAgapao@Yahoo.com
Searches for tables who's names contain the search string. Gives Aggregate Size, Rows, Index, and Column information as well.LIKE wildcards are not automatic, which allows for easy 'begins with', 'ends with', and 'equal to' queries.Improvements from Mk1: Added PartitionCount, IndexCount, ColumnCount, TotalMaxColumnLength, HasPrimaryKey, and HasClusteredIndex.Requires the VIEW DATABASE STATE database permission.
Update 2009-01-14: Fixed Rows Output - Was being erroneously multiplied by (1+#NonClusteredIndexes) SUM(Rows) Should be SUM(CASE WHEN index_id BETWEEN 0 AND 1 THEN row_count ELSE 0 END)
Update 2009-09-21: Added HasUniqueIndex, ClusteredIndexIsUnique, PrimaryKeyIsClustered, and NonPKUniqueIndexCount. Added searching of indexed (materialized; has a clustered index) views Added searching of system tables
Update 2009-10-01: Fixed system object searching (Catelog views do not have sys.dm_db_partition_stats entries) Added optional output of non-materialized virtual table objects Size and index output columns will be NULL for these. All system catelog views and DMVs are non-materialized.
Required Input Parameters: @TableName sysname Filters tables. Can use LIKE wildcards. All tables if blank.
Optional Input Parameters: @SchemaName sysname='' Filters schemas. Can use LIKE wildcards. All schemas if blank. @VirtualTables TinyInt=0 Search virutal tables (views, table-valued functions) - Size and Index output will be NULL for these @UserOjbects TinyInt=1 Search user objects @SystemObjects TinyInt=0 Search system objects
Usage EXECUTE Util_TableSearch '%mpi%' EXECUTE Util_TableSearch @SchemaName='dbo', @TableName='%order%'
Copyright: Licensed under the L-GPL - a weak copyleft license - you are permitted to use this as a component of a proprietary database and call this from proprietary software. Copyleft lets you do anything you want except plagarize, conceal the source, proprietarize modifications, or prohibit copying & re-distribution of this script/proc.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
see <http://www.fsf.org/licensing/licenses/lgpl.html> for the license text.
Procedure to search any database (or a combination of databases, including all) for a specific strin...
Indexes for Booking Search
Searches for objects (including CLR) who's names contain the search string. outputs IDs, names, and ...
Full text search VS Indexing
This Simple script will help to do a Server wide search for an object name or usage of a String in O...