|
INTERVIEW QUESTIONS
DATABASE
MS SQL SERVER
DETAILS
Question: What Are the Basic Features of a Trigger in MS SQL Server?
Answer: Since a SQL Server trigger is a really an event handler, it has the following basic features similar to event handlers in other programming languages:
* Event Type - It must be declared to handle a specific event, like a DELETE event. * Object Scope - It must be declared to handle events in a specific database object scope, like a specific table. * Statement Body - It must have a statement body, a batch of statements to be executed when the specified event occurs in specified database object scope. An event handler (trigger) with an empty statement body is useless. * Access of Event Attributes - It must have access to some attributes of the event, so it can have different logics for different instances of the event. For example, you can implement a trigger to send a security alert message to each user whenever his or her password is changed. This trigger should have the following features:
* Event Type - It must be declared to handle the UPDATE event. * Object Scope - It must be declared to handle the UPDATE event on the user password table only. * Statement Body - It must have a statement body to determine if the password is really changed or not. If it is changed, send an email to the user's email address. * Access of Event Attributes - It must have access to some attributes of the event instance, like the old value and the new value of the password, and the user email address.
|
|
|
Category |
MS SQL Server Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.2) By 7693 users |
Added on |
9/24/2014 |
Views |
68918 |
Rate it! |
|
|
Question:
What Are the Basic Features of a Trigger in MS SQL Server?
Answer:
Since a SQL Server trigger is a really an event handler, it has the following basic features similar to event handlers in other programming languages:
* Event Type - It must be declared to handle a specific event, like a DELETE event. * Object Scope - It must be declared to handle events in a specific database object scope, like a specific table. * Statement Body - It must have a statement body, a batch of statements to be executed when the specified event occurs in specified database object scope. An event handler (trigger) with an empty statement body is useless. * Access of Event Attributes - It must have access to some attributes of the event, so it can have different logics for different instances of the event. For example, you can implement a trigger to send a security alert message to each user whenever his or her password is changed. This trigger should have the following features:
* Event Type - It must be declared to handle the UPDATE event. * Object Scope - It must be declared to handle the UPDATE event on the user password table only. * Statement Body - It must have a statement body to determine if the password is really changed or not. If it is changed, send an email to the user's email address. * Access of Event Attributes - It must have access to some attributes of the event instance, like the old value and the new value of the password, and the user email address. Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
What Are Triggers in MS SQL Server?
|
View Answer
|
|
How To Drop an Existing Schema in MS SQL Server?
|
View Answer
|
|
What Happens If You Are Trying to Access a Schema Not Owned by You?
|
View Answer
|
|
How To Change the Ownership of a Schema in MS SQL Server?
|
View Answer
|
|
Who Is the Owner of a Schema in MS SQL Server?
|
View Answer
|
|
What Is the Default Schema of Your Login Session in MS SQL Server?
|
View Answer
|
|
How To List All Objects in a Given Schema?
|
View Answer
|
|
How To Transfer an Existing Table from One Schema to Another Schema in MS SQL Server?
|
View Answer
|
|
How To Create a New Table in a Given Schema?
|
View Answer
|
|
How To List All Schemas in a Database?
|
View Answer
|
|
How To Create a New Schema in a Database?
|
View Answer
|
|
What Is a Schema in MS SQL Server 2005?
|
View Answer
|
|
How To Create an Multi-Statement Table-Valued Function?
|
View Answer
|
|
How To Create an Inline Table-Valued Function?
|
View Answer
|
|
How Many Ways to Create Table-Valued Functions?
|
View Answer
|
|
How Many Categories of Functions based Their Return Modes?
|
View Answer
|
|
How To Provide Default Values to Function Parameters?
|
View Answer
|
|
Can You Pass Expressions to Function Parameters?
|
View Answer
|
|
How To Provide Values to User Defined Function Parameters?
|
View Answer
|
|
How To Create User Defined Functions with Parameters?
|
View Answer
|
Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.
View All MS SQL Server Interview Questions & Answers - Exam Mode /
Learning Mode
|