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.
| Author |
Topic |
|
hztm2
Starting Member
16 Posts |
Posted - 2010-05-20 : 10:49:04
|
| Is there any way I can do something in a select query to get a mixture of numbers and text to order with the the numbers in numeric order. Suppose I have a table with a single varchar field RefNoRefNo100120N1234561002SELECT RefNo FROM Table ORDER BY RefNo produces1001002120N123456this is exactly what I would expect but is there any way I can get the query to order the data in numeric order as below:1001201002N123456Thank you |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2010-05-20 : 10:55:08
|
Try something like this:order by right(replicate(' ',30)+RefNo,30)CODO ERGO SUM |
 |
|
|
hztm2
Starting Member
16 Posts |
Posted - 2010-05-20 : 11:14:54
|
| Thank you very much indeed - that does exactly what I needed - I guess I have a lot to learn!Many thanks again |
 |
|
|
|
|
|