Click here to Skip to main content
15,895,922 members
Articles / Database Development / SQL Server

how to arrange by status code in sql server

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
8 Oct 2012CPOL 0  
You cannot rearrage these columns. What you can do is you can add a new column DisplayOrder in whic you say the order in which it is to be displayed.statuscode statusid StatusCount DisplayOrder Just Received 1 7 1Sent to Engineer 2 ...

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
8 Oct 2012DINESH K MAURYA 4 alternatives  
Dear all,i have a table i want to arrange this table value given code formateit is Status table statuscode statusid StatusCountJust Received 1 7Sent to Engineer 2 30Estimation Not Approved 4 2Under QC 9 ...
Please Sign up or sign in to vote.
8 Oct 2012Dinesh Ambaliya
Add another column for status code and sort order by status code when select records
Please Sign up or sign in to vote.
8 Oct 2012OriginalGriff
You will need to either add a column which provides the sort order, or write a monolithic CASE statement:SELECT * FROM MyTable ORDER BY CASE statuscode WHEN 'Just Recieved' THEN 1 WHEN 'Pending For Estimation' THEN 2... ELSE 9999 ENDI would add the column,...
Please Sign up or sign in to vote.
8 Oct 2012Aarti Meswania
create new table,table = ProcessFlowNo ProcessName1 Just Received2 Pending For Estimation3 Pending For Engineer Estimation4 Pending For Estimation Approval5 Estimation Not Approved 6 Sent to Engineer7 Under QC8 QC Passed9 Pending Payment 10 ...

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead EF (Education First)
India India
I graduated as Production Engineer and started my career as Software Developer then worked as tester for a while before moving into Windows application development using Microsoft Technologies. But for the last few years i am working on javascript, React, Node, AWS, Azure Chatbots

Comments and Discussions