'Select all rows but park on specific
I need to show all rows in a table but park on a specific one.
Select * from t_table
will show me all but park on the top.
select * from t_table where id=1000
will only show me id=1000.
what I need is
select * from t_table locate id=1000
is this possible ?
If the storedprocedure showing this select has a parameter @PartCode. This can be NULL (show all) of a certain partcode. f.e. 2000443
The select in the stored procedure should park on this partcode but not filter

Solution 1:[1]
use top 1
select top 1 * from t_table order by id desc
Solution 2:[2]
You could achieve this with a case statement in an order by. It would always return your specific record as row 1 but would still order by other IDs below.
Something like the following should work:
ORDER BY
CASE Partcode
WHEN 2000443 THEN 1 --2000443 being the ID to return first.
ELSE 2
END, id
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Piyush Kachhadiya |
| Solution 2 |

