Interview Questions Part-2 | What are the Different Types of Triggers | What is a View | What is the Difference between a Function and a Stored Procedure | What are the Advantages of Using Stored Procedures in SQL Server
By: Suresh Dasari Oct 5, 2011
Categories: Interview Questions
What are the Different Types of Triggers?
After triggers and Instead of triggers
After triggers are the triggers which are raised before the transaction committed or postback.
Instead of triggers are used to update the database tables which are associated with view instead of updating the view directly.
What is a View?
A view is virtual table based on result set of sql statement which contains rows and columns just like real table. The fields in view are fields from real tables in the databases.
Ex: Create VIEW [view_name] as select Column_Name from table_name where condtion
A view serves as a security mechanism. This ensures that users are able to retrieve and modify only the data seen by them. Users cannot see or access the remaining data in underlying tables.
A view also serves as mechanism to simply query execution. Complex queries can be stored in the form as a view and data from the view can be extracted using simple queries
What is the Difference between a Function and a Stored Procedure?
Stored procedure returns one or more values where as function can return one value that is mandatory
Stored procedure can have input and output parameters where as function is having only input parameters.
Functions can be called from procedures but procedures cannot be called from functions
Exceptions can be handled by try-catch block in procedures whereas try-catch block cannot be used in function. (Read more Here)
Other Related Posts
- Interview Questions in ASP.NET,C#.NET,SQL Server,.NET Framework
- Asp.net insert, Edit, update, delete data in gridview
- 3 tier architecture example in asp.net with C#
- Introduction to Object Oriented Programming Concepts (OOPS) in C#.net
- Simple login form example in asp.net Check Username and Password availability in database
- Introduction to WCF - WCF tutorial | WCF Tutorial - Windows Communication Foundation | WCF Example | WCF Sample code in asp.net 3.5 | Basic WCF Tutorial for Beginners
- how to insert images into database and how to retrieve and bind images to gridview using asp.net (or) save and retrieve images from database using asp.net
- jQuery 360 Degrees Image Display Plugins Examples with Tutorial
- Asp.net WebService or Creating and Consuming WebService in asp.net or Create and call webservice in asp.net or how to create webservice and how to use webservice in asp.net
- Best Login Page Design in HTML, CSS with Source Code