Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Order 1,2,3,4,5,6,7,8,9,10,11 looks like 1,10,11,2,3,4,5,6,7,8,9

Status
Not open for further replies.

RSX02

Programmer
May 15, 2003
467
0
0
CA
I have a Stored Procedure that print orders.
This is link with a Crystal Report.
Every Order line print on this report.
My problem is that if i have lines:
1
2
3
4
5
6
7
8
10
11

it won't print in this order but in THIS order:
1
10
11
2
3
4
5
6
7
8
9

Why I might doing wrong. As my stored procedure is very too long to post it here..
 
What data type is the field? It seems to be returning a text value rather than a numeric value, as they are listing in alphabetic order.
 
I agree with Double02, it looks like the order # is stored as a char or varchar type.

Try modifying your query as such:
Code:
SELECT  Order#
FROM  Orders
ORDER BY CONVERT(int, ORDER#)
See if this works.

Hope this helps,
John
 
it is declared as a int...
 

SELECT * FROM @ReportSet
ORDER BY pack_num, co_num ASC, co_line ASC, co_release ASC

Where co_line and co_release are declared as INT...
 
I have the same report in another site but the stored procedure is quite different... And this part of the code is the same in both SP. And the other works well. So I guess this is not this part of the code that makes the difference but I just cannot see what else it could be as I don't have other order by link to the field Co_line in my SP....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top