SQL Server Find largest tables
Here is a query to SQL Server find largest tables in a database. It’s very important for a DBA to monitor table size over time to foresee storage requirement/performance issues. The below query can be...
View ArticleFind tables with identity columns in SQL Server
In this blog we’ll see T-SQL query to find tables with identity columns In SQL Server. It can be done in two ways either by using Information_schema catalog or the system catalog views. A T-SQL to...
View ArticleT-SQL find all identity columns
Here’s a T-SQL find all identity columns in a database.SELECT OBJECT_SCHEMA_NAME(tables.object_id, db_id()) AS SchemaName, tables.name As TableName, columns.name as ColumnName FROM sys.tables tables...
View ArticleT-SQL find tables without primary key
Here’s a T-SQL find tables without primary key.SELECT OBJECT_SCHEMA_NAME(tables.object_id,db_id()) AS SchemaName, tables.name As TableName FROM sys.tables tables join sys.indexes indexes ON...
View ArticlePrimary key not null in SQL Server
A Jr. Developer asked me why a primary key not null in SQL Server. A primary key uniquely identifies a row in a table and a NULL can’t identify any row. Moreover, a primary key is used to find rows in...
View Article