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)
 order by problem

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-10-29 : 23:44:51
Rob writes "I have a commission_code table with 2 columns:

comm_code varchar(8)
amount smallmoney

This table populates a select on an asp page. Some of the comm_codes are numeric (1, 2, 23, 12, etc) and some are strings (L1, L2, S4, etc).

Is is possible to return the rows ordered by the numeric comm_codes followed by the strings in ONE sql statement?

I have tried 'select * from commission_code order by comm_code'. Using the data above, this returns 1, 12, 2, 23, L1, L2, S4. The numeric values are not in order. I cannot use convert() in the order by because it fails on the string values.

Currently I am using 2 sql statements with the isNumeric() function, and it gets the job done, but there has to be a better way.

Thanks!

Rob"

paulmelba
Starting Member

8 Posts

Posted - 2007-05-15 : 15:49:52
SPAM DELETED
Go to Top of Page
   

- Advertisement -