<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SQL Server Trigger - MSSQL Query</title>
	<atom:link href="https://mssqlquery.com/tag/sql-server-trigger/feed" rel="self" type="application/rss+xml" />
	<link>https://mssqlquery.com</link>
	<description>MSSQL and TSQL Programming and TSQL Examples</description>
	<lastBuildDate>Fri, 07 Apr 2023 19:27:35 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.3.1</generator>

<image>
	<url>https://mssqlquery.com/wp-content/uploads/2023/06/cropped-mssql-query-icon-32x32.png</url>
	<title>SQL Server Trigger - MSSQL Query</title>
	<link>https://mssqlquery.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Where is Trigger Used Most in SQL Server?</title>
		<link>https://mssqlquery.com/where-is-trigger-used-most-in-sql-server</link>
		
		<dc:creator><![CDATA[Yavuz Selim Kart]]></dc:creator>
		<pubDate>Sat, 11 Mar 2023 12:16:53 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Triggers]]></category>
		<category><![CDATA[SQL Server Trigger]]></category>
		<category><![CDATA[Trigger]]></category>
		<category><![CDATA[Trigger all database]]></category>
		<guid isPermaLink="false">https://mssqlquery.com/?p=1417</guid>

					<description><![CDATA[<p>Hello everyone, In this article, I will try to give information about where Triggers are used most in SQL Server. Triggers are used in SQL Server to automatically execute a set of SQL statements or stored procedures when specific database events occur, such as INSERT, UPDATE, or DELETE operations on&#46;&#46;&#46;</p>
<p>The post <a href="https://mssqlquery.com/where-is-trigger-used-most-in-sql-server">Where is Trigger Used Most in SQL Server?</a> first appeared on <a href="https://mssqlquery.com">MSSQL Query</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Hello everyone,</p>
<p>In this article, I will try to give information about where Triggers are used most in SQL Server.</p>
<p>Triggers are used in SQL Server to automatically execute a set of SQL statements or stored procedures when specific database events occur, such as INSERT, UPDATE, or DELETE operations on a table. Triggers are commonly used for the following purposes:</p>
<ol>
<li><strong>Enforcing Business Rules:</strong> Triggers can be used to enforce business rules and data integrity constraints. For example, a trigger can be used to prevent users from deleting a record if it is referenced by other records in the database.</li>
<li><strong>Auditing Changes:</strong> Triggers can be used to log changes made to database tables. For example, a trigger can be used to write a record to an audit trail table whenever a row is updated or deleted.</li>
<li><strong>Replicating Data:</strong> Triggers can be used to replicate data from one database to another. For example, a trigger can be used to replicate new records inserted into a table in one database to a table in another database.</li>
<li><strong>Updating Views:</strong> Triggers can be used to update views when underlying data is changed. For example, a trigger can be used to update a view that shows a list of employees whenever a new employee is added to the Employees table.</li>
<li><strong>Notification:</strong> Triggers can be used to send notifications to users or applications when specific events occur in the database. For example, a trigger can be used to send an email to a supervisor whenever a new employee is added to the Employees table.</li>
</ol>
<p>In summary, triggers are used in SQL Server for a variety of purposes, including enforcing business rules, auditing changes, replicating data, updating views, and sending notifications.</p>
<p>Good luck to everyone in business and life.</p>
<div class='epvc-post-count'><span class='epvc-eye'></span>  <span class="epvc-count"> 54</span><span class='epvc-label'> Views</span></div><p>The post <a href="https://mssqlquery.com/where-is-trigger-used-most-in-sql-server">Where is Trigger Used Most in SQL Server?</a> first appeared on <a href="https://mssqlquery.com">MSSQL Query</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Viewing Trigger Creation and Update Detail in SQL Server</title>
		<link>https://mssqlquery.com/viewing-trigger-creation-and-update-detail-in-sql-server</link>
		
		<dc:creator><![CDATA[Yavuz Selim Kart]]></dc:creator>
		<pubDate>Sun, 24 Jul 2022 10:55:44 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Triggers]]></category>
		<category><![CDATA[SQL Server Trigger]]></category>
		<category><![CDATA[Trigger Creation and Update Detail in SQL Server]]></category>
		<category><![CDATA[Viewing Trigger]]></category>
		<guid isPermaLink="false">https://mssqlquery.com/?p=1022</guid>

					<description><![CDATA[<p>Hello everyone, In this article, I will try to give information about the creation and updating of Trigger in SQL Server. In SQL Server, in some cases, you may want to view the creation and update details of the Trigger. You can easily do this using the code below. SELECT&#46;&#46;&#46;</p>
<p>The post <a href="https://mssqlquery.com/viewing-trigger-creation-and-update-detail-in-sql-server">Viewing Trigger Creation and Update Detail in SQL Server</a> first appeared on <a href="https://mssqlquery.com">MSSQL Query</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Hello everyone,</p>
<p>In this article, I will try to give information about the creation and updating of Trigger in SQL Server.</p>
<p>In SQL Server, in some cases, you may want to view the creation and update details of the Trigger.</p>
<p>You can easily do this using the code below.</p>
<pre class="line-numbers"><code class="language-sql">SELECT o.name AS [Trigger Name],
       CASE
           WHEN o.type = 'TR' THEN
               'SQL DML Trigger'
           WHEN o.type = 'TA' THEN
               'DML Assembly Trigger'
       END AS [Trigger Type],
       sc.name AS [Schema_Name],
       OBJECT_NAME(parent_object_id) AS [Table Name],
       o.create_date [Trigger Create Date],
       o.modify_date [Trigger Modified Date]
FROM sys.objects o
    INNER JOIN sys.schemas sc
        ON o.schema_id = sc.schema_id
WHERE (
          type = 'TR'
          OR type = 'TA'
      );</code></pre>
<p>When you run the above code, you will see a result similar to the one below.</p>
<p><img decoding="async" fetchpriority="high" class="alignnone wp-image-1025 size-full" src="https://mssqlquery.com/wp-content/uploads/2022/07/viewing-trigger-creation-and-update-detail-in-sql-server-1.jpg" alt="Viewing Trigger Creation and Update Detail in SQL Server" width="700" height="523" srcset="https://mssqlquery.com/wp-content/uploads/2022/07/viewing-trigger-creation-and-update-detail-in-sql-server-1.jpg 700w, https://mssqlquery.com/wp-content/uploads/2022/07/viewing-trigger-creation-and-update-detail-in-sql-server-1-300x224.jpg 300w" sizes="(max-width: 700px) 100vw, 700px" /></p>
<p>As you can see, we have displayed the creation and updating details of the Trigger.</p>
<p>Good luck to everyone in business and life.</p>
<div class='epvc-post-count'><span class='epvc-eye'></span>  <span class="epvc-count"> 206</span><span class='epvc-label'> Views</span></div><p>The post <a href="https://mssqlquery.com/viewing-trigger-creation-and-update-detail-in-sql-server">Viewing Trigger Creation and Update Detail in SQL Server</a> first appeared on <a href="https://mssqlquery.com">MSSQL Query</a>.</p>]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Trigger Preventing Table Creation in SQL Server</title>
		<link>https://mssqlquery.com/trigger-preventing-table-creation-in-sql-server</link>
		
		<dc:creator><![CDATA[Yavuz Selim Kart]]></dc:creator>
		<pubDate>Thu, 03 Mar 2022 17:17:16 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Triggers]]></category>
		<category><![CDATA[SQL Server Table Trigger]]></category>
		<category><![CDATA[SQL Server Trigger]]></category>
		<category><![CDATA[Trigger Table]]></category>
		<category><![CDATA[TSQL Trigger Example]]></category>
		<guid isPermaLink="false">https://mssqlquery.com/?p=754</guid>

					<description><![CDATA[<p>Hello everyone, In this article, I will provide information about creating triggers that prevent table creation in SQL Server. In SQL Server, in some cases, we may not want a table to be created in the current database. You can easily do this using the code below. CREATE TRIGGER StopTableCreation&#46;&#46;&#46;</p>
<p>The post <a href="https://mssqlquery.com/trigger-preventing-table-creation-in-sql-server">Trigger Preventing Table Creation in SQL Server</a> first appeared on <a href="https://mssqlquery.com">MSSQL Query</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Hello everyone,</p>
<p>In this article, I will provide information about creating triggers that prevent table creation in SQL Server.</p>
<p>In SQL Server, in some cases, we may not want a table to be created in the current database.</p>
<p>You can easily do this using the code below.</p>
<pre class="line-numbers"><code class="language-sql">CREATE TRIGGER StopTableCreation
ON DATABASE
FOR CREATE_TABLE
AS
PRINT 'This database does not allow new tables.';
ROLLBACK TRANSACTION;

--Create Table Code

CREATE TABLE Table1
(
    ID INT
);

</code></pre>
<p>When you run the above code, you will see a result similar to the one below.</p>
<p><img decoding="async" class="alignnone wp-image-757 size-full" src="https://mssqlquery.com/wp-content/uploads/2022/03/trigger-preventing-table-creation-in-sql-server-1.jpg" alt="Trigger Preventing Table Creation in SQL Server" width="700" height="96" srcset="https://mssqlquery.com/wp-content/uploads/2022/03/trigger-preventing-table-creation-in-sql-server-1.jpg 700w, https://mssqlquery.com/wp-content/uploads/2022/03/trigger-preventing-table-creation-in-sql-server-1-300x41.jpg 300w" sizes="(max-width: 700px) 100vw, 700px" /></p>
<p>As you can see, we could not create a table.</p>
<p>Good luck to everyone in business and life.</p>
<div class='epvc-post-count'><span class='epvc-eye'></span>  <span class="epvc-count"> 145</span><span class='epvc-label'> Views</span></div><p>The post <a href="https://mssqlquery.com/trigger-preventing-table-creation-in-sql-server">Trigger Preventing Table Creation in SQL Server</a> first appeared on <a href="https://mssqlquery.com">MSSQL Query</a>.</p>]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
