Nov 8, 2015

SQL Server Interview Questions (Part-4)

What is a transaction?
A transaction is a logical unit of work in which, all the steps must be performed or none.
Read more in detail...

What are ACID properties
ACID stands for Atomicity, Consistency, Isolation, Durability. These are the properties of a transaction.

Difference Between Implict Transaction And Explict Transaction
Implicit Transaction is auto commit and there is no beginning or ending of the transaction.
Explicit Transaction has the beginning, ending and rollback of transactions with the command
Begin Transaction, Commit Transaction and Rollback Transation
In the explicit transaction, if an error occurs in between we can rollback to the begining of the transaction which cannot be done in implicit transaction.

What is the use of @@TRANCOUNT in SQL Server?
@@TRANCOUNT returns the number of active transactions for the current connection.

What is a deadlock?
Deadlock is a situation when two processes, each having a lock on one piece of data, attempt to acquire a lock on the other’s piece. Each process would wait indefinitely for the other to release the lock, unless one of the user processes is terminated.

What is NOLOCK?
NOLOCK is used to query data which is affected by the transaction  but yet committed. Querying uncommited data using NOLOCK is called "dirty read"

How to Get nth Record in a Table?
Refer this post : find nth highest salary

How to generate Random number in SQL Server?
Refer this post : generate random number for each row in SQL

How to delete duplicate record in SQL?
Refer this post : delete duplicate records in SQL

How do we find the last date of current month?
SQL Server 2012 introduced function EOMONTH to find the last date of the month
In prior versions, we have to write our own logical script
Refer this post : Last day of Month

What is computed column in SQL Server?
Computed Column is the column whose values are generated with an expression. An expression can be a non-computed column name, constant, function and combination of any of these connected by one or more operators. Computed columns can be used in select list, where clause, order by clause.
Read more in detail with example...

What is the use of @@ROWCOUNT?
@@ROWCOUNT returns the number of row(s) affected as a result of DML statement like Insert/Update/Delete.

    Choose :
  • OR
  • To comment
No comments:
Write comments

Software developers who need to create installer files for their applications can choose Windows Installer, Inno Setup, Actual Installer, and others.