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

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_idIn […]

Continue Reading

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

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 clustered index is already defined on a […]

Continue Reading

Question of the Month (July)

Question of the Month Suppose we have a table emp_plan  which contains 4 columns “Empid” (employeeid), Planid (Projectid), Startdate(Allocation Start date) and Enddate (Allocation Enddate). Its structure is given below:-4  Create table emp_plan (empid nvarchar(200),planid nvarchar(20),startdate datetime, enddate datetime) Also below is the script to enter sample data into the table:- insert into emp_plan(empid,planid,startdate,enddate) select ‘001’,’planA’,’2015-05-15′,’2015-05-30′ […]

Continue Reading