In this blog I am not going to write a big epic on how to crack interviews but just briefing on it i
[More]
How to get the list of all tables that are not having any indexes on them :
Today, I got a question on this and decided to put the way here also.
SELECT [name] AS Tables_Without_Indexes
FROM sys.tables
WHERE OBJECTPROPERTY(OBJECT_ID,'IsIndexed') = 0
ORDER BY 1;
The above statemen...
[More]
There is a system stored procedure “sp_helpindex”, which can be used to get the list of all existing indexes by supplying table name to it. We can use this stored procedure as –
EXECUTE sp_helpindex my_Table_Name
[More]
I was looking for SQL Server diagram understanding and found a good article on Atif Shehzad.One can find and read this nice article - Getting started with SQL Server database diagrams
We can use sys.triggers view (object schema view) to know the status of trigger(s) in a database.
USE [myDatabaseName]
GO
SELECT * FROM sys.triggers
WHERE [is_disabled] = 1 ; -- 0:Enabled and 1:Disabled
To get the status of a particular trigger:
SELECT * FROM sys.triggers
WHER...
[More]
Two easiest command syntacx to disable /enable existing triggers on table are as below-
To Disable-
ALTER TABLE [mySchemaName].[myTableName] DISABLE TRIGGER myTriggerName
OR
DISABLE TRIGGER myTriggerName ON [mySchemaName].[myTableName]
To Enable-
ALTER TABLE [...
[More]
23. April 2012
Anil Kumar
MS-SQL
Triggers are used to implement business rules, automate or to enforce referential integrity in database applications. Some important points/info about Triggers are -1) Avoid using cursor in Triggers.2) Avoid executing many sql statements on other tables also.3) Avoid returning multi-row-results...
[More]