SQL Interview Questions And answers
1. What is the use of SET NOCOUNT ON?
SET NOCOUNT ON is used to stops the message that shows the count of the number of rows affected by a Transact-SQL Statement or Stored Procedure from being returned as part of the result set.
When SET NOCOUNT is ON, the count is not returned.
When SET NOCOUNT is OFF, the count is returned.
setting SET NOCOUNT to ON can provide a significant performance boost because network traffic is greatly reduced.
2. What is RAISEERROR? And Uses of RAISEERROR?
It is used to return messages back to the application using the same format as a system error or warning message generated by the SQL Server Database Engine.
Uses of RAISEERROR
The Database Engine is the core service for storing, processing, and securing data. The Database Engine provides controlled access and rapid transaction processing to meet the requirements of the most demanding data consuming applications within your enterprise.
Use the Database Engine to create relational databases for online transaction processing or online analytical processing data. This includes creating tables for storing data, and database objects such as indexes, views, and stored procedures for viewing, managing, and securing data. You can use SQL Server Management Studio to manage the database objects, and SQL Server Profiler to capture server events.
SET NOCOUNT ON is used to stops the message that shows the count of the number of rows affected by a Transact-SQL Statement or Stored Procedure from being returned as part of the result set.
When SET NOCOUNT is ON, the count is not returned.
When SET NOCOUNT is OFF, the count is returned.
setting SET NOCOUNT to ON can provide a significant performance boost because network traffic is greatly reduced.
2. What is RAISEERROR? And Uses of RAISEERROR?
It is used to return messages back to the application using the same format as a system error or warning message generated by the SQL Server Database Engine.
Uses of RAISEERROR
- Check the values of data
- Return messages that contain variable text
- Cause exception to jump from a TRY block to the associated CATCH block
- Return error information from the CATCH block to the calling batch or application
- Help in troubleshooting Transact-SQL code
The Database Engine is the core service for storing, processing, and securing data. The Database Engine provides controlled access and rapid transaction processing to meet the requirements of the most demanding data consuming applications within your enterprise.
Use the Database Engine to create relational databases for online transaction processing or online analytical processing data. This includes creating tables for storing data, and database objects such as indexes, views, and stored procedures for viewing, managing, and securing data. You can use SQL Server Management Studio to manage the database objects, and SQL Server Profiler to capture server events.
Comments
Post a Comment