Issues with Object Explorer grouping

In the screen shot below, you can see where I was using the Toad Object explorer
on the Data tab to see what distinct values I have in a table. You can see where
there are two "Delivery Detentions" listed, but in the query from SSMS on the
right, you see that there is clearly only one distinct value for "Delivery
Detentions".

You will notice that there are other values that show more than one grouping
when there should only be one:

Carrier Did Not Follow Instructions

Delivery to Wrong Location

Driver Behavior

There are more outside the screen shot that was captured.

Thanks,

Matt

image001.png


Hi Matt,

It seems the categories you are talking about have different names - the difference is spaces at the end.
Can you please check it and come back with your findings.
Will be very much appreciated for this.

Regards,
Valentin

OK, I did a rtrim(ltrim()) and indeed, there are spaces.

I also tried distinct and/or len() and that still produced the
results with spaces???

So SQL Server automatically trims spaces when using distinct and when using the
len function…interesting. But to me SQL Server should be including the space
when looking at the field data as I believe that the space (Dec 32) is
considered a “Printable Character”.

Thanks for pointing that out. I never thought of it that way.

Matt