Is this for an insert or update statement? or are you just trying to display it from a SELECT statement? Is SortOrder an actual column in the table you are storing, or is it just a calculated value you want to be able to display and use on the page? I need a bit more context about how you are using the value and in what scenario.