How to Display RowNumber with Select Query in SQL Server 2005

rownumber() function is used to return the rownumber with select query

The Follwoing query will return the result set row number

Syntax ROW_NUMBER ( ) OVER ( [ ] )

Example Select row_number() over(order by productid) as SlNo,productname,unitprice from products

RollBack Transaction in SQL Server 2005

SQL Server 2005 newly intoduced the way to rollback the transactions in SQL Server 2005

SET XACT_ABORT ON

when XACT_ABORT is on. The T-SQL statements will automatically rollback the transaction when error occured in statements.

SET XACT_ABORT ON

USE Emp Begin Tran Insert into EmpInfo Values(1) Insert into EmpInfo Values(1) — This statement will raise […]