Generate and retrieving Next sequential Customerid

There is a need for me to  list all customerid plus e next sequential CustomerId. in this table the customerid is not a primary key. I think a subquery should. How can i modify the below query to achieve this
select Distinct Customer_Id from customers
from (select MAX (Customer_Id) + 1 from customers where CUSTOMER_ID <> 999 )

Open in new window

Who is Participating?
Aneesh RetnakaranDatabase AdministratorCommented:
select MAX (Customer_Id) + 1 from customers
SELECT Customer_id from Customers
What if the table is updated after you query it? What if the next inserted row gets rolled back or deleted? Your assumption about the next sequential Id may be incorrect. Whether that matters or not depends on how you are using the information.
ProjackAuthor Commented:
Thanks for your advice. It is admin moduleand only one operator use that page per time
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.