How to Allow Users to Control Sort Order in SQL Server Results

  It is basic knowledge that the ORDER BY clause will pretty much sort our data using available columns in a SQL Server table in ascending or descending order. But what if we want to allow a user of an application to resort items (rows) in a table in their own desired order where ascending or descending on existing columns would not work? For example, we might want to present a list of items and allow them to re-sort the items in any order they desire. How do we store and retrieve that data in a SQL Server table so that it displays in the order expected? This article will provide one … [Read more...]