Working with Collation Versioning

This content has moved to another location. See International Support for the latest version.

Tags :


Community Content

Shawn Steele [MSFT]
GetNlsVersionEx is REQUIRED to correctly distinguish if a sort behavior has changed!

GetNlsVersionEx is required to correctly distinguish if a sort behavior has changed!

GetNlsVersionEx is preferred. The original version of this API doesn't return enough information in the case of a custom locale to tell if the sort has changed.

Tags :

Shawn Steele [MSFT]
Steps to tell if a sort version changed (ie: you need to reindex):

Steps to tell if a sort version changed (ie: you need to reindex):

  1. Use GetNLSVersionEx() to retrieve an NLSVERSIONINFOEX structure when doing the original indexing of your data.
  2. Store the following properties with your index to identify the version:
    NLSVERSIONINFOEX.dwNLSVersion - This specifies the version of the sorting table you're using.
    NLSVERSIONINFOEX.dwEffectiveId - This specifies the effective locale of your sort. A custom locale will point to an in-box locale's sort.
    NLSVERSIONINFOEX.guidCustomVersion - This is a GUID specifying a specific custom sort for custom locales that have them.
  3. When using the index use GetNlsVersionEx() to discover the version of your data.
  4. If any of the three properties has changed, the sorting data you're using could return different results and any indexing you have may fail to find records.
  5. If you KNOW that your data doesn't contain invalid Unicode code points (ie: all of your strings passed a call to IsNLSDefineString()) then you may consider them the same if ONLY the low byte of dwNLSVersion changed (the minor version described above).

Blogged more about it at: http://blogs.msdn.com/shawnste/archive/2007/06/01/how-to-tell-if-the-collation-version-changed.aspx

Hope that helps, Shawn

Tags :

Page view tracker