Triggers

SQLServerCentral Article

Row-By-Row Processing Without Cursor

  • Article

If you are a SQL Server DBA, you realize that the performance of cursors is not great and they should be avoided where possible. One place it is difficult to avoid cursors is individual row processing within a trigger. Amin Sobati brings us a new article that shows just how you can avoid this.

2.88 (93)

You rated this post out of 5. Change rating

2007-12-28 (first published: )

47,958 reads

Technical Article

Using DDL Database Triggers

  • Article

In this short demonstration, you'll learn how to use DDL database triggers to prevent changes to product and audit changes to comply with Sarbanes-Oxley and other change management requirements. Free registration required.

2006-07-20

3,395 reads

SQLServerCentral Article

Worst Practice - Triggering External Events

  • Article

Andy Warren started his worst practice series some time ago with the intention of looking at the worst things you can do. Given that we may not always be able to implement the best practices, at least we can try to avoid doing things harm the system or decrease performance. This article continues the series and looks at an item I see mentioned in our discussion forum quite often, triggering external events. From a trigger.

You rated this post out of 5. Change rating

2004-02-23

10,246 reads

SQLServerCentral Article

Bypassing Triggers

  • Article

This articles covers a variety of techniques to let you bypass or conditionally execute code in a trigger based on criteria outside of the inserted/deleted tables. It also includes a contest that gives you a chance to win a copy of our book The Best of SQLServerCentral.com 2002!

5 (5)

You rated this post out of 5. Change rating

2003-11-24

12,544 reads

SQLServerCentral Article

Testing for an Updated Column in a Trigger

  • Article

The columns_updated function gives you the ability to easily test to see if specific columns were modified with less code than you might otherwise need to use. In this article Andy Warren demonstrates how to create a trigger that uses this function and points out some reasons why you may NOT want to use it!

4 (3)

You rated this post out of 5. Change rating

2003-08-21

18,218 reads

SQLServerCentral Article

Triggers in SQL Server 7.0 and 2000 - What's New

  • Article

This is the second of a two part series on how triggers work in the two latest versions of MS SQL Server. The first part dealt with what is common between the two versions. This article will detail what's been added to SQL Server 2000.

4 (1)

You rated this post out of 5. Change rating

2005-06-24 (first published: )

72,969 reads

Blogs

The Book of Redgate: We Value Teams

By

This value is something that I still hear today: our best work is done...

Troubleshooting TempDB Log Full Errors When SSMS Won’t Connect

By

Have you ever received the dreaded error from SQL Server that the TempDB log...

Accelerating AI with Confidence: Why Microsoft Purview is Key to Responsible Innovation

By

Artificial intelligence is no longer a distant concept. It is here, embedded in the...

Read the latest Blogs

Forums

Is there a way for SP to know who called it?

By water490

Hi everyone I am writing an SP where there is logic inside the SP...

Planning for tomorrow, today - database migrations

By John Martin

Comments posted to this topic are about the item Planning for tomorrow, today -...

Bottlenecks on SQL Server performance

By runarlan

We have a BI-application that connects to input tables on a SQL Server 2022...

Visit the forum

Question of the Day

The Tightly Linked View

I try to run this code on SQL Server 2022. All the objects exist in the database.

CREATE OR ALTER VIEW OrderShipping
AS
SELECT cl.CityNameID,
       cl.CityName,
       o.OrderID,
       o.Customer,
       o.OrderDate,
       o.CustomerID,
       o.cityId
 FROM dbo.CityList AS cl
 INNER JOIN dbo.[Order] AS o ON o.cityId = cl.CityNameID
GO
CREATE OR ALTER FUNCTION GetShipCityForOrder
(
    @OrderID INT
)
RETURNS VARCHAR(50)
WITH SCHEMABINDING
AS
BEGIN
    DECLARE @city VARCHAR(50);
    SELECT @city = os.CityName
    FROM dbo.OrderShipping AS os
    WHERE os.OrderID = @OrderID;
    RETURN @city;
END;
go
What is the result?

See possible answers