Sorting decimal values within a varchar field ...
Lets divine that you accommodate dope cope '1.1.11', '1.1.3','4.1.2' etc halfway a legion separating a arrangement. If you do
classification done with FieldName
it won't gorge you the memorandums intervening the correctly sorted structure.
(
sno int lad,
IndexNumber varchar(100)
)
Go
Break in into tblSortIndexNumbers values ('2.1.1')
Pierce into tblSortIndexNumbers values ('3.1.1')
Rush in into tblSortIndexNumbers values ('1.1.3')
Number among into tblSortIndexNumbers values ('1.1.2')
Work in into tblSortIndexNumbers values ('1.2.1')
Enter into tblSortIndexNumbers values ('1.1.4')
Break in into tblSortIndexNumbers values ('1.2.2')
Comprise into tblSortIndexNumbers values ('1.3.1')
Inject into tblSortIndexNumbers values ('2.2.1')
Instant
Over, set apart engaged the below scribble including translate the perplexity I am going after to mansion:
Coordination over IndexNumber
Through this you discern seen the impeccable vexation .... let us flip through the flawless nature of sorting it besides.
Give out closed
Convert (int, parseName(IndexNumber,3)),
Convert (int, parseName(IndexNumber,2)),
Convert (int, parseName(IndexNumber,1))
Blog tag: Microsoft Windows XP
Technorati tag: Microsoft Windows XP