I have the below table in my SQL Server Data Base:
Table script:
- CREATETABLE [dbo].[Employee_Rank](
- [EmployeeName] [varchar](50)NULL,
- [Rank] [int] NULL
- )ON [PRIMARY]
-
- GO
Data in Table:
Now my requirement is below:
So I wrote the below SQL Statement:
- DECLARE @SRNO INT=0;
- UPDATE EMPLOYEE_RANK SET @SRNO =RANK= @SRNO + 1
-
- SELECT*FROM EMPLOYEE_RANK