I have a table with OrderSequence, the schema looks roughly like this: - id - Name - OrderSequence I have an arrays of ids ["1", "2", "3", "4"] from application, i want to set the SequenceOrder for sorting purpose. I don't want to loop it via the application and execute N number of sql queries. How should i do it using stored procedures? Now the looks like ------- id Name OrderSequence 1 A 0 2 B 0 3 C 0 What i want to achieve ------ id Name OrderSequence 1 A 1 2 B 2 3 C 3 Using a stored procedure is ideal or if there's a way to update this in one sql command?