Programs used:
SQL Server 2000, Excel 2003
We have a table in our database called Samples. Using the following query...
SELECT [Sample], [Flag] FROM Samples
ORDER BY [Sample]
... we get the following results:
Sample Flag
---------- ----
12-ABC-345 1
123-45-AB 0
679-ADC-12 1
When the user has the same data in an Excel spreadsheet, and sorts by the Sample column, they get the following sort order:
Sample Flag
---------- ----
123-45-AB 0
12-ABC-345 1
679-ADC-12 1
Out of curiosity, why is there a discrepancy between the sort in SQL and Excel (other than, "because it's Microsoft").
Is there a way in SQL to sort on the Sample column in the same method as the Excel method, or vice versa?