How to: Sort SQL Results in Your Own Preferred Order

Classic sorting method allows you to sort table base on particular column either ascending or descending order. The following method allow you to customize the sorting result in your own preferred order, for instance sort a list of SQL Server in your environment based on server environment.

SELECT * FROM [SQL_ServerList]
ORDER BY
	(CASE ServerType
	WHEN 'PROD'	THEN 1
	WHEN 'QA'	THEN 2
	WHEN 'DEV'	THEN 3 END), 
	[Instance Name], [SQLServer Name]