12,404,478 members (70,631 online)
Rate this:
See more:
How to add the extended properties on Trigger in SQL Server 2008 R2.
I want to add "MS_Description" on a trigger.
Posted 15-Mar-13 8:21am

Rate this:

## Solution 1

Use below query to add the MS_Desciption to a Trigger:

@name = N'MS_Description',
@value = N'TRIGGER DESCRIPTION',
@level0type = N'SCHEMA', @level0name = dbo,
@level1type = N'TABLE', @level1name = TABLENAME,
@level2type = N'TRIGGER', @level2name = TRIGGERNAME;

GO
Rate this:

Rate this:

## Solution 3

```CREATE DATABASE EMPLOYEES
USE EMPLOYEES

SELECT * FROM SAL_INFO

INSERT INTO SAL_INFO VALUES('A',50000)
INSERT INTO SAL_INFO VALUES('B',40000)
INSERT INTO SAL_INFO VALUES('C',30000)
SELECT * FROM SAL_INFO

CREATE TABLE EMP(EMP_NO INT,EMP_NAME VARCHAR(50),DEPT_NO CHAR(5),GRADE CHAR(2),BSAL NUMERIC(8,2))
SELECT * FROM EMP

CREATE TRIGGER TR_EMP ON EMP
FOR INSERT,UPDATE
AS
DECLARE @SAL NUMERIC(8,2)
SELECT @SAL = SAL_INFO.SAL FROM SAL_INFO,INSERTED
UPDATE EMP SET BSAL = @SAL FROM EMP,INSERTED
WHERE EMP.EMP_NO =  INSERTED.EMP_NO

INSERT INTO EMP VALUES(1001,'SAJU','D101','A',NULL)
INSERT INTO EMP VALUES(1002,'MUJI','D102','B',NULL)
INSERT INTO EMP VALUES(1003,'NIYAS','D103','C',NULL)
SELECT * FROM EMP```

Top Experts
Last 24hrsThis month
 ppolymorphe 190 Karthik Bangalore 190 OriginalGriff 168 Richard MacCutchan 127 0x01AA 110
 OriginalGriff 7,411 ppolymorphe 3,230 Karthik Bangalore 3,177 Richard MacCutchan 2,372 F-ES Sitecore 2,262