Link to home
Start Free TrialLog in
Avatar of AZZA-KHAMEES
AZZA-KHAMEESFlag for Bahrain

asked on

Auto increment column

Hi Experts
i need to add an auto increment column to and distinct SQL query that was generated from #Temp table
--------------------
select distinct b.* from #Temp1 as a
inner join #TempCourses as b on a.CourseId = b.Courseid and a.[Request Date] = b.[From Date]
-------------------
ASKER CERTIFIED SOLUTION
Avatar of Dorababu M
Dorababu M
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It would be better to add a new column to that temporary table when you create it but it is also good to add it later with identity default:

ALTER TABLE #Temp1
        ADD NewID INT NULL IDENTITY(1,1)

SELECT * FROM #Temp1

Open in new window