custom sort for nvarchar columntypes

  • Hi

    I am working on an ASP.Net app with MS SQL 2005 as the back end

    I wish to sort the data in all the nvarchar type fields as follows:

    1, 1.1, 1.1.2, 1.2, 2.0, ...... 10.1, .... A1....etc

    Can you please guide me through what needs to be done? If possible,I would also like to set this as the default sort.

    Thanks

    Adish

  • I think you'd have to use CLR to create a sort for this. I've never done it, but if you perform a search, there is sample code available.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Thanks Grant, I will try that out. Maybe I should be looking for the solution on .Net forums also.

    Adish

  • Possibly. But I think there might be some samples for how to do it locally.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply