Hi. The Transact-SQL script below 1 returns the following information: ID – Just an identity column used within the script SchemaName – The name of the schema TableName – Obviously, the name of the table 🙂 ColumnName Type – The data type of the column Length – The maximum number of bytes used by the […]
I wanted to produce a list of the MAX of date fields (DateTime, SmallDateTime, TimeStamp) for all tables within all databases held in an instance of SQL Server.
The script below was written for SQL Server 2000, but should be easily customisable for SQL Server 2005
The script within this post returns a list of all tables (along with the schema name), and indexes (where they exist), and the name of the associated file group.
This will useful to find out which objects have been assigned to the wrong file group.
I have a database with over 10 file groups, and wanted to find out why there was over 50Gb of data in the PRIMARY file group, even though there were only a couple of tables in that group. When I ran this script, I discovered there were some indexes that had been incorrectly created in the PRIMARY group!!!
The Transact-SQL script in this post returns a list of tables and a count of the number of records within each table.
The code contained in this post can be used to find all tables that contain columns that have “ADDRESS” in the name. It can easily be modified to search for table column names with any specific word.
The Transact-SQL script in this post which was written for SQL Server 2005, returns a list of the values and a count for each and every field within a table. You just need to change the schema name and table name, and specify a limit (if needed) for the number of values returned for each field.
Useful script to generate a list of tables for all the databases on a server
The Transact-SQL query in this post returns the table name, column name, data type, and maximum length. This is useful when producing database documentation