General
This category contains general information relating to SQL Server
Rebuild or Reorganize Indexes?
03 years ago
in General
The query below can be used to identify those indexes that should be rebuilt (using ALTER INDEX REBUILD WITH (ONLINE = ON), or those that should be reorganized (USING ALTER INDEX REORGANIZE):
SELECT object_name(a.object_id) as TableName,
a.index_id,
a.Index_Type_Desc,
b.name AS [...]
List of database tables, with count of records.
03 years ago
in General
Use the script below, 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.
DECLARE @TableName VARCHAR(100)
DECLARE @Schema VARCHAR(100)
DECLARE @SQL VARCHAR(1000)
DECLARE [...]