I work on a code, I wish to make this type of code like I delete one and more bill on SQL server database then after I arrange or update my bill number column value, for example:- bill number is (1,2,3,4,5) then I delete my same bill record or row (1,3,5) so how can I update or arrange sequence wise bill number like this (1,2,3,).
It's almost impossible to know what you are asking
but you can order the SQL set with ORDER BY ( https://docs.microsoft.com/en-us/sql/t-sql/queries/select-order-by-clause-transact-sql?view=sql-server-ver15 )
or if you need a sequential integer I would propose you add something to your query like this
SELECT *,
ROW_NUMBER() OVER(ORDER BY bill_no) AS rowNumber
FROM YourTable
that should gie you a sequential integer for each row in your set.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.