Search code examples
character-encodingsybasedatabase-administrationsap-ase

Sybase ASE: show the character encoding used by the database


I am working on a Sybase ASE database and would like to know the character encoding (UTF8 or ASCII or whatever) used by the databae.

What's the command to show which character encoding the database uses?


Solution

  • The command you're looking for is actually a system stored procedure:

    1> sp_helpsort
    2> go
    ... snip ...
    Sort Order Description
     ------------------------------------------------------------------
     Character Set = 190, utf8
         Unicode 3.1 UTF-8 Character Set
         Class 2 Character Set
     Sort Order = 50, bin_utf8
         Binary sort order for the ISO 10646-1, UTF-8 multibyte encodin
         g character set (utf8).
    ... snip ...
    

    From this output we see this particular ASE dataserver has been configured with a default character set of utf8 and default sort order of binary (bin_utf8). This means all data is stored as utf8 and all indexing/sort operations are performed using a binary sort order.

    Keep in mind ASE can perform character set conversions (for reads and writes) based on the client's character set configuration. Though the successfulness of said conversions will depend on the character sets in question (eg, a client connecting with utf8 may find many characters cannot be converted for storage in a dataserver defined with a default character set of iso_1).