Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Collation/Sort Order for "Outline Numbered Data"

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-11-15 : 07:33:25
Eric writes "Assume I have data with one column containing an "outline numbering" value:
a.1
a.2
a.2.1
a.3
a.10.1

A SELECT ordered by this column would return the records with the "a.10.1" record immediately after the "a.1" record. How (and what) do I need to do in order to return the "alphabetic part before the dot" sorted with the "numeric part after the dot", when the field itself is defined as a varchar?

This is for SQL Server 2000, SP4, on a Windows 2003 Server/IIS6 platform.

Thank you,

Eric Kestler
ekestler@bigfoot.com"

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2005-11-15 : 08:46:01
Pad these numbers with leading "00000"'s before sorting.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-11-15 : 08:59:26
How about storing each part in seperate columns and sort by those columns?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -