January 18, 2006 at 8:20 am
Hi
I am facing one issue regarding sorting using ado components. In our application we are using sort procedure of ado table to sort the records in grid based on column click.
However, the sorting done above is different from the sorting done when we actually fire a query in query analyzer in sql server using order by clause.
Below is the output we get when directly sorted using order by clause (asc) on COLUMN1 in sql query analyzer:
COLUMN1
SC-BOMAN
SC-BOSTON
SC-BPUNE
SC-OMAN
SC-PUNE
SCB-N.S.RD
SCB-NEPAL
SCB-NEW LO
SCB-NORTH
SCB-NY
SCB-OMAN
SCB-PORTRD
SCBP-BANG
Below is the output we get using sort procedure on database through application using sort procedure on table (ascending order)
SCB-N.S.RD
SCB-NEPAL
SCB-NEW LO
SCB-NORTH
SCB-NY
SC-BOMAN
SCB-OMAN
SC-BOSTON
SCBP-BANG
SCB-PORTRD
SC-BPUNE
SC-OMAN
SC-PUNE
The values with hyphen are not getting sorted correctly when done through application.
We are using delphi 6 and sql server 2000 with ado for connecting to database through application
Any suggestions or pointers to resolve this issue.
January 18, 2006 at 11:46 am
There seem to be some indendations (whitespace?), is the column defined as char?
What is the patch level of the ado component (mdac 2.8?)
January 18, 2006 at 9:25 pm
The column is defined as varchar.
The SQL Server 2000 has SP3 patch ( MDAC 2.71)
January 19, 2006 at 10:45 am
It looks to me like the hyphen characters are being ignored by the sort routine. Are you specifying a character set for the sort? A custom comparison function? Are those leading spaces in your result real or just an artifact of posting the list on the web page?
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply