Hello,

Please Review following Query: (I m using SQL Server 2000)

SELECT J.Job_ID,(Select Max(Task_ID) FROM Tasks With(NoLock))+1, t2.SIGNALED_OVERDUE, null FROM JOBS J
INNER join Tasks T1 on j.job_id = T1.Job_ID and T1.Template_ID = 7 and T1.Task_Status = 0
INNER join Tasks T2 on j.job_id = T2.Job_ID and T2.Template_ID = 6 and T2.Task_Status < 3
WHERE j.TEMPLATE_ID = 1

I want the Second Value of this query to be contineously incremented by 1 in each row fetched by this query. In Select query can i do this ?

I can do this with cursors or Hash table or Table variable. But in all of them loop is involved which i want to avoid, since the query has to run on fairly large database.

Please Help me in this regard

Thanks in advanced

Regards

Nido