function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mercury HolidaysMercury Holidays 

Force different collation on SOQL Order By?

I'm currently using a SOQL Object Query as part of an SSIS package and I need the data sorted for the next step in my SSIS data flow.

However, SOQLs "Order by" does not produce the sort order that SSIS expects and uses internally. For example, the list:

aa
ab
a-b
ac

Comes out like this with a SOQL Order By, which uses ASCII sorting:

a-b
aa
ab
ac

But SSIS is expecting the list like this, as it uses Windows Collation:

aa
a-b
ab
ac

Is there any way to force the SOQL Order By to use Windows Collation instead of its default? Is there any workaround in SOQL to get the list sorted how I want?

And yes I know I can use SSIS Sort Transformations, but I'm trying to avoid them because they're clunky and expensive. I can use them as a last resort, but I'd prefer the data sorted at source.
David Zhu 🔥David Zhu 🔥
Based on Salesforce documentation, Sort order is determined by current user locale. For English locales, Salesforce uses a sorting mechanism based on the UTF-8 values of the character data. For Asian locales, Salesforce uses a linguistic sorting mechanism based on the ISO 14651 and Unicode 3.2 standards.
You may have to use SSIS Sort Transformation.
Mercury HolidaysMercury Holidays
Thank you. I guess I will use the SSIS Sort Transformations. It's a shame SOQL doesn't allow you to customise this, SQL has some ability to tell it what sorting mechanism to use as part of the Order By caluse.