<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; 2005 &#8211; Disable Triggers &#8211; Drop Triggers</title>
	<atom:link href="http://blog.sqlauthority.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Fri, 17 May 2013 15:26:57 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #024 &#124; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/#comment-454844</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #024 &#124; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Sat, 13 Apr 2013 01:31:53 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/#comment-454844</guid>
		<description><![CDATA[[...] Disable Triggers – Drop Triggers Till today I use it extensively when I have to disable or drop trigger. [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Disable Triggers – Drop Triggers Till today I use it extensively when I have to disable or drop trigger. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yashaswini</title>
		<link>http://blog.sqlauthority.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/#comment-301568</link>
		<dc:creator><![CDATA[Yashaswini]]></dc:creator>
		<pubDate>Fri, 15 Jun 2012 06:27:58 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/#comment-301568</guid>
		<description><![CDATA[How to drop a trigger for DDL events?
I want to create and alter a table in database but error is coming saying, &#039;Cannot drop the trigger &#039;trigger_altertable&#039;, because it does not exist or you do not have permission&#039;.
If i want to alter a table. Can u plz help me out of this........]]></description>
		<content:encoded><![CDATA[<p>How to drop a trigger for DDL events?<br />
I want to create and alter a table in database but error is coming saying, &#8216;Cannot drop the trigger &#8216;trigger_altertable&#8217;, because it does not exist or you do not have permission&#8217;.<br />
If i want to alter a table. Can u plz help me out of this&#8230;&#8230;..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: king</title>
		<link>http://blog.sqlauthority.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/#comment-257493</link>
		<dc:creator><![CDATA[king]]></dc:creator>
		<pubDate>Tue, 28 Feb 2012 05:25:32 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/#comment-257493</guid>
		<description><![CDATA[yes !! of course..
as u are telling that there are 5 tables.. for 3 tables that u don&#039;t want to drop u can write triggers as normal but include a statement like if drop/delete  command raises &#039;rollback trans&#039; end..
Njoy..

note: its just my thought i hve not tried. excuse me if it is wrong]]></description>
		<content:encoded><![CDATA[<p>yes !! of course..<br />
as u are telling that there are 5 tables.. for 3 tables that u don&#8217;t want to drop u can write triggers as normal but include a statement like if drop/delete  command raises &#8216;rollback trans&#8217; end..<br />
Njoy..</p>
<p>note: its just my thought i hve not tried. excuse me if it is wrong</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Abhishek Singh</title>
		<link>http://blog.sqlauthority.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/#comment-243350</link>
		<dc:creator><![CDATA[Abhishek Singh]]></dc:creator>
		<pubDate>Wed, 25 Jan 2012 09:32:50 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/#comment-243350</guid>
		<description><![CDATA[hello sir,
i am using sql server 2008 and i have got 5 tables in my database.
i want to make sure that 3 of the 5 tables could not be dropped by any user
(even the admin) and the other two can be dropped.
the 3 tables (not to be dropped) does not have any referential integrity.
does this problem have any other solution than schemabinding, i.e. using triggers?]]></description>
		<content:encoded><![CDATA[<p>hello sir,<br />
i am using sql server 2008 and i have got 5 tables in my database.<br />
i want to make sure that 3 of the 5 tables could not be dropped by any user<br />
(even the admin) and the other two can be dropped.<br />
the 3 tables (not to be dropped) does not have any referential integrity.<br />
does this problem have any other solution than schemabinding, i.e. using triggers?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER &#8211; Significance of Various Kinds of Triggers- Quiz &#8211; Puzzle &#8211; 2 of 31 &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/#comment-230362</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Significance of Various Kinds of Triggers- Quiz &#8211; Puzzle &#8211; 2 of 31 &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Tue, 03 Jan 2012 01:31:32 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/#comment-230362</guid>
		<description><![CDATA[[...] SQL Server Interview Questions and Answers ISBN: 1466405643 Page#24-25 Disadvantages (Problems) of Triggers Server and Database Level DDL Triggers Examples and Explanation Disable All Triggers on a Database – Disable All Triggers on All Servers Interesting Observation of Logon Trigger On All Servers Disable Triggers – Drop Triggers [...]]]></description>
		<content:encoded><![CDATA[<p>[...] SQL Server Interview Questions and Answers ISBN: 1466405643 Page#24-25 Disadvantages (Problems) of Triggers Server and Database Level DDL Triggers Examples and Explanation Disable All Triggers on a Database – Disable All Triggers on All Servers Interesting Observation of Logon Trigger On All Servers Disable Triggers – Drop Triggers [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: masood</title>
		<link>http://blog.sqlauthority.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/#comment-103779</link>
		<dc:creator><![CDATA[masood]]></dc:creator>
		<pubDate>Sat, 04 Dec 2010 23:10:05 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/#comment-103779</guid>
		<description><![CDATA[To add one more point for triggers, there is also something called server level triggers which can be found under server node-&gt;Server Objects-&gt;Triggers. This is applicable to all the databases under that server like DDL_LOGIN_EVENTS etc to track logins.]]></description>
		<content:encoded><![CDATA[<p>To add one more point for triggers, there is also something called server level triggers which can be found under server node-&gt;Server Objects-&gt;Triggers. This is applicable to all the databases under that server like DDL_LOGIN_EVENTS etc to track logins.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ashwini</title>
		<link>http://blog.sqlauthority.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/#comment-62909</link>
		<dc:creator><![CDATA[Ashwini]]></dc:creator>
		<pubDate>Sun, 14 Mar 2010 19:43:11 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/#comment-62909</guid>
		<description><![CDATA[Very Precise explanation, Thanks .
It has solved all my confusion about the storage of Triggers in DB.]]></description>
		<content:encoded><![CDATA[<p>Very Precise explanation, Thanks .<br />
It has solved all my confusion about the storage of Triggers in DB.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kuldip</title>
		<link>http://blog.sqlauthority.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/#comment-54169</link>
		<dc:creator><![CDATA[Kuldip]]></dc:creator>
		<pubDate>Tue, 28 Jul 2009 13:05:39 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/#comment-54169</guid>
		<description><![CDATA[Article is small and nice but explanation of imran is very nice and very useful,truly DDL triggers is very nice feature.]]></description>
		<content:encoded><![CDATA[<p>Article is small and nice but explanation of imran is very nice and very useful,truly DDL triggers is very nice feature.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jose Ahumada</title>
		<link>http://blog.sqlauthority.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/#comment-44020</link>
		<dc:creator><![CDATA[Jose Ahumada]]></dc:creator>
		<pubDate>Sun, 02 Nov 2008 18:57:14 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/#comment-44020</guid>
		<description><![CDATA[Thanks i find the triggers just like sql 2000 thank&#039;s a lot man]]></description>
		<content:encoded><![CDATA[<p>Thanks i find the triggers just like sql 2000 thank&#8217;s a lot man</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Imran Mohammed</title>
		<link>http://blog.sqlauthority.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/#comment-41994</link>
		<dc:creator><![CDATA[Imran Mohammed]]></dc:creator>
		<pubDate>Mon, 25 Aug 2008 03:26:10 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/#comment-41994</guid>
		<description><![CDATA[Dear Joyce,

This feature is also available in SQL Server 2005. 

If you login into SSMS, expand Servername- expand database - expand table- under tables 4th subobject you will see trigger - expand triggers ( to see all triggers in that table) - right click on any one of the trigger and click modify and you will see a new query window with SQL code for that trigger, If you want to make changes to this trigger, make necessary changes in the sql code and then hot execute button at the top. ( same as to execute any query.) and you are done.

You also mentioned something about, Programmability under Database ( in object explorer, SSMS), let me explain you in brief what exactly is this. 

Objects in a database can be : Tables, views, stored procedures and functions ....  


So when we are talking about triggers, these are specific for tables, because triggers (DML, Data Manipulation Language Triggers) can be created on tables for/instead of  insert ,update and delete. That is why you will see triggers under tables but not under Programmability. 

Now the second question, When you expand programmability, you will see database triggers , what are these triggers ???

This is a brand new concept in SQL Server 2005, these are called DDL Triggers, Data Definition Language ( these are not available in SQL Server 2000). 

These triggers, as the name defines are used for all DDL operations like create, alter, drop... You cant imagine how many types of these triggers are available in SQL Server 2005. DML like I said are only 3 types, Insert update and delete, but if you read books online, you will see, there are many many types for DDL Triggers. This is very good feature in SQL Server 2005. Since these triggers are not for a specific table, they cannot be placed under tables( in SSMS, object Explorer) , so I assume designer found it very handy to keep these triggers under programmability, and names these triggers as Database triggers, since these triggers are at database level but not for a specific table. 

Here is a very quick example for both of these triggers,

-- Create two tables 
create table example1 ( eid1  int )
create table example2 ( eid2 int )

-- create insert trigger on table : example1
create trigger Tr_ex1
on example1
for insert 
as 
begin
insert into example2 select * from inserted
end

-- insert into table: example1
insert into example1 values ( 1)

-- check table: example2 if this value is inserted
select * from example2

By this time you should be able to see this trigger ( Tr_ex1) under table name example1. ( in SSMS , object explorer). Right click on trigger and click modify, you will see the same SQL code as above, if you want to modify, you can modify and click execute and you are done.

-- create another table to store information about, who dropped tables, when and from which database and at what time. 
create table example3 ( UserName varchar (max), databasename varchar(max), Date_time datetime)

-- create DDL trigger 
CREATE TRIGGER Tr_ex2 
ON DATABASE 
FOR DROP_TABLE 
AS 
insert into example3 select suser_name() , db_name(), getdate() 


 By this time you should be able to see a database trigger, under programmability by name Tr_ex2. ( in SSMS , object explorer). Right click on trigger and click modify, you will see the same SQL code as above, if you want to modify, you can modify and click execute and you are done.

-- Drop table: example2
drop table example2

-- check table:example3 if it shows information about who dropped table from which database and at what time.

select * from example3

Result:

IMRAN\imran	databasename	2008-08-23 23:10:09.617

Read more about DDL Triggers : http://blog.sqlauthority.com/2007/07/24/sql-server-2005-server-and-database-level-ddl-triggers-examples-and-explanation/


Hope this helps,
Imran.]]></description>
		<content:encoded><![CDATA[<p>Dear Joyce,</p>
<p>This feature is also available in SQL Server 2005. </p>
<p>If you login into SSMS, expand Servername- expand database &#8211; expand table- under tables 4th subobject you will see trigger &#8211; expand triggers ( to see all triggers in that table) &#8211; right click on any one of the trigger and click modify and you will see a new query window with SQL code for that trigger, If you want to make changes to this trigger, make necessary changes in the sql code and then hot execute button at the top. ( same as to execute any query.) and you are done.</p>
<p>You also mentioned something about, Programmability under Database ( in object explorer, SSMS), let me explain you in brief what exactly is this. </p>
<p>Objects in a database can be : Tables, views, stored procedures and functions &#8230;.  </p>
<p>So when we are talking about triggers, these are specific for tables, because triggers (DML, Data Manipulation Language Triggers) can be created on tables for/instead of  insert ,update and delete. That is why you will see triggers under tables but not under Programmability. </p>
<p>Now the second question, When you expand programmability, you will see database triggers , what are these triggers ???</p>
<p>This is a brand new concept in SQL Server 2005, these are called DDL Triggers, Data Definition Language ( these are not available in SQL Server 2000). </p>
<p>These triggers, as the name defines are used for all DDL operations like create, alter, drop&#8230; You cant imagine how many types of these triggers are available in SQL Server 2005. DML like I said are only 3 types, Insert update and delete, but if you read books online, you will see, there are many many types for DDL Triggers. This is very good feature in SQL Server 2005. Since these triggers are not for a specific table, they cannot be placed under tables( in SSMS, object Explorer) , so I assume designer found it very handy to keep these triggers under programmability, and names these triggers as Database triggers, since these triggers are at database level but not for a specific table. </p>
<p>Here is a very quick example for both of these triggers,</p>
<p>&#8211; Create two tables<br />
create table example1 ( eid1  int )<br />
create table example2 ( eid2 int )</p>
<p>&#8211; create insert trigger on table : example1<br />
create trigger Tr_ex1<br />
on example1<br />
for insert<br />
as<br />
begin<br />
insert into example2 select * from inserted<br />
end</p>
<p>&#8211; insert into table: example1<br />
insert into example1 values ( 1)</p>
<p>&#8211; check table: example2 if this value is inserted<br />
select * from example2</p>
<p>By this time you should be able to see this trigger ( Tr_ex1) under table name example1. ( in SSMS , object explorer). Right click on trigger and click modify, you will see the same SQL code as above, if you want to modify, you can modify and click execute and you are done.</p>
<p>&#8211; create another table to store information about, who dropped tables, when and from which database and at what time.<br />
create table example3 ( UserName varchar (max), databasename varchar(max), Date_time datetime)</p>
<p>&#8211; create DDL trigger<br />
CREATE TRIGGER Tr_ex2<br />
ON DATABASE<br />
FOR DROP_TABLE<br />
AS<br />
insert into example3 select suser_name() , db_name(), getdate() </p>
<p> By this time you should be able to see a database trigger, under programmability by name Tr_ex2. ( in SSMS , object explorer). Right click on trigger and click modify, you will see the same SQL code as above, if you want to modify, you can modify and click execute and you are done.</p>
<p>&#8211; Drop table: example2<br />
drop table example2</p>
<p>&#8211; check table:example3 if it shows information about who dropped table from which database and at what time.</p>
<p>select * from example3</p>
<p>Result:</p>
<p>IMRAN\imran	databasename	2008-08-23 23:10:09.617</p>
<p>Read more about DDL Triggers : <a href="http://blog.sqlauthority.com/2007/07/24/sql-server-2005-server-and-database-level-ddl-triggers-examples-and-explanation/" rel="nofollow">http://blog.sqlauthority.com/2007/07/24/sql-server-2005-server-and-database-level-ddl-triggers-examples-and-explanation/</a></p>
<p>Hope this helps,<br />
Imran.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joyce</title>
		<link>http://blog.sqlauthority.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/#comment-41988</link>
		<dc:creator><![CDATA[Joyce]]></dc:creator>
		<pubDate>Mon, 25 Aug 2008 01:00:03 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/#comment-41988</guid>
		<description><![CDATA[Hi Pinal,
the article is very useful. however, how do I alter an existing trigger? I am able to find the trigger using SELECT *
FROM sys.triggers but I can&#039;t view the content / alter it

I&#039;ve seen in SQL Server 2000 you can right click the table which has the triggers and All Tasks &gt; Manage Triggers but can&#039;t do this in SQL 2005. 

I don&#039;t see any triggers listed in the db &gt;programmability&gt; database triggers section

Do I have to delete the entire trigger and re-create it? How do I view the content of an existing trigger using an SQL statement?]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,<br />
the article is very useful. however, how do I alter an existing trigger? I am able to find the trigger using SELECT *<br />
FROM sys.triggers but I can&#8217;t view the content / alter it</p>
<p>I&#8217;ve seen in SQL Server 2000 you can right click the table which has the triggers and All Tasks &gt; Manage Triggers but can&#8217;t do this in SQL 2005. </p>
<p>I don&#8217;t see any triggers listed in the db &gt;programmability&gt; database triggers section</p>
<p>Do I have to delete the entire trigger and re-create it? How do I view the content of an existing trigger using an SQL statement?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER - Disable All Triggers on a Database - Disable All Triggers on All Servers Journey to SQL Authority with Pinal Dave</title>
		<link>http://blog.sqlauthority.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/#comment-16795</link>
		<dc:creator><![CDATA[SQL SERVER - Disable All Triggers on a Database - Disable All Triggers on All Servers Journey to SQL Authority with Pinal Dave]]></dc:creator>
		<pubDate>Mon, 29 Oct 2007 14:37:38 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/04/13/sql-server-2005-disable-triggers-drop-triggers/#comment-16795</guid>
		<description><![CDATA[[...] Oct 29th, 2007 by pinaldave    Just a day ago, I received question in email regarding my article SQL SERVER - 2005 Disable Triggers - Drop Triggers. [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Oct 29th, 2007 by pinaldave    Just a day ago, I received question in email regarding my article SQL SERVER &#8211; 2005 Disable Triggers &#8211; Drop Triggers. [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
