The script within this post, outputs a list of each DATETIME and SMALLDATETIME field within a database, along with the minimum and maximum values. Useful to identify tables that have a date created or updated column, and you want to find out if they are still being used.
Tag: Database
SQL: Get Last Used (Max) Date from each Date field in a database
If you need to find out if a database is being used (or when it was last updated), a useful script contained within this post, will return the maximum date for each and every date/time field within all tables in the current database
SQL: Return the MAX of all dates within all tables within all databases
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
SQL: Count number of records in each table within a database
The Transact-SQL script in this post returns a list of tables and a count of the number of records within each table.
SQL: List of database files
The script in this post can be used to extract a list of databases along with the files associated with each database. The size (according to SQL Server) is also returned in pages and bytes.
SQL: Generate a list of tables for all databases on a server
Useful script to generate a list of tables for all the databases on a server
SQL: List of primary key fields within a database
The query in this post return a list of Table Name, Column Name, and Column ID for all Primary Key columns within a database
SQL: List of database tables, with count of records.
Script to return a list of database tables (the schema and table name) along with a count of the records within each table. This can come in useful if you are trying to compare databases.