• You should do it another way. When normalizing the database there should be a table containg all available statusids. Your data table should then have a foreignn key to the statusid-table. When doing so you can add a column to the statusid-table where you define the sort order.

    Something like this:

    create table dbo.domStatus(

    StatusId int not null,

    SortOrder int not null

    primary key ( StatusId )

    );

    create table dbo.SomeDataTable(

    Col1 varchar(50),

    Col2 varchar(50),

    StatusId int not null

    );

    alter table dbo.SomeDataTable add constraint fk_SomeDataTable_domStatus

    foreign key ( StatusId ) references dbo.domStatus ( StatusId );

    select ...

    from dbo.SomeDataTable d inner join

    dbo.domStatus s on

    s.StatusId = d.StatusId

    ORDER BY s.SortOrder