General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Big Problem in Alpha sort using Stored Procedures
Can someone help me with my problem? I have a table consisting of LName C(20) GName C(20) Grade C(2)
&& Note: Grade contains mixed of Alpha and Numeric
I am trying to sort my table using a function inside my Stored Procedure which will alphasort combining grade and name
My function inside the Stored Proc goes like this:
Function asort
DO CASE
case grade="1"
nretval = 10
case grade="2"
nretval = 12
case grade="3"
nretval = 14
case grade="1b"
nretval = 20
ENDCASE
cOrder = ALLT(STR(nRetVal) + UPPER(ALLT(Lname)+ALLT(gName))
RETURN cOrder
I noticed that if u return an Character it wont sort properly but if u return a numeric the sorting goes well.
Someone have an idea about This... Thanks. I reallt appreciate ur reply.
This is only a sample table that i can come up.
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only