Add Serial No/Identity Column in Select Statement SQL Script in run time

Table Name : EmployeeInfo
We have to Select EmpName, Address, and Extra Serial column then


select e.EmpName, e.Address,id_col=count(*)
from EmployeeInfo e,EmployeeInfo b
where (e.EmpName+e.Address)<=(b.EmpName+b.Address)
group by e.EmpName, e.Address
order by id_col

or

select EmpName, Address, id_col=IDENTITY(int,1,1)
into #tmpEmp
from EmployeeInfo

select * from #tmpEmp

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন