DATETIME SELECT SELECT INTO DATE PAD STRING DYNAMIC SQL CURSOR MONEY FORMAT PERCENT STORED PROCEDURE SQL SERVER AGENT JOB OPTIMIZATION WHILE LOOP OVER PARTITION BY UPDATE
 
 
SITE SEARCH SQLUSA.com VIDEOS
 
 
SQL E/BOOKS   WORLD, USA & SQL NEWS   FORMAT
SCRIPTS SQL 2005 SQL 2008 ARTICLES
How to block a column update with a trigger?

The following trigger will block updates on the NationalIDNumber column in the Employee table. It can be used for business rule enforcement.

USE AdventureWorks2008;

GO

CREATE TRIGGER trgHRSSNBlock

ON HumanResources.Employee

FOR UPDATE

AS

  IF UPDATE(NationalIDNumber)

    BEGIN

      RAISERROR ('SSN cannot be updated',10,1)

      ROLLBACK TRANSACTION

    END

GO

 

-- The following update statement will be rolled back:

UPDATE HumanResources.Employee

SET    NationalIDNumber = '123-46-7890'

WHERE  EmployeeID = 7

GO

 

Exam Prep 70-461
SQL 2016 DESIGN & PROGRAMMING
 
 
 
DATETIME SELECT SELECT INTO DATE PAD STRING DYNAMIC SQL CURSOR MONEY FORMAT PERCENT STORED PROCEDURE SQL SERVER AGENT JOB OPTIMIZATION WHILE LOOP OVER PARTITION BY UPDATE