Category Archives: SQL Advanced

SQL Script to find all the triggers defined on a database or on a single table

By | August 14, 2015

SQL Script to find triggers in SQL Database Sometime we need to find all the triggers defined on the database. So in this case, we can use the below SQL Query:-SELECT tbl.name as [Table Name] , trig.name as [Trigger Name] , trig.is_disabled FROM [sys].[triggers] as trig INNER JOIN sys.tables as tbl ON trig.parent_id = tbl.object_id… Read More »

Interview question – Is Clustered index on column with duplicate values possible?

By | August 13, 2015

Clustered index on column with duplicate values Through this article, we are going to discuss three important interview questions of SQL which are given below:-   1) Can we create clustered index on a column containing duplicate values?  2) Can we create a Primary Key on a table on which a clustered index is already defined? 3) If a… Read More »

Importance of Best Practices in database programming

By | February 1, 2015

Best Practices in database programming For any programming language, just writing the code is not well enough. It should be written using the best practices. This article will try to explain the disadvantages of writing code without using Best Practices and later on how best practices can be implemented in our database code. Code written… Read More »

SQL Script to find the missing indexes

By | January 25, 2015

Script to find the missing indexes Performance tuning in SQL is important exercise and index creation is an important part of it. Below script will help in finding the missing indexes. Once you create these indexes, it will help in improving the Performance.SELECT db_name(d.database_id) dbname , object_name(d.object_id) tablename , d.equality_columns , d.inequality_columns , d.included_columns ,’CREATE INDEX [missing_index_’ +… Read More »