SQL Server Identify Unused Tables & Indexes
It often happens that DBA’s/Developers end up creating database objects(mostly tables) during development phase for various reasons like intermediate testing or backup. Such objects often end up on...
View ArticleT-SQL script delete column from a table
It’s a common task that needs to be done on development/test environment. Though it seems that deleting a column from a table is just running an ALTER TABLE statement, however it’s bit more than this....
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