DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(mysql.info.gz) Charset-CAST

Info Catalog (mysql.info.gz) Charset-CONVERT (mysql.info.gz) Charset-operations (mysql.info.gz) Charset-SHOW
 
 10.4.3 `CAST()'
 ---------------
 
 You may also use `CAST()' to convert a string to a different character
 set. The syntax is:
 
      CAST(CHARACTER_STRING AS CHARACTER_DATA_TYPE CHARACTER SET CHARSET_NAME)
 
 Example:
 
      SELECT CAST(_latin1'test' AS CHAR CHARACTER SET utf8);
 
 If you use `CAST()' without specifying `CHARACTER SET', the resulting
 character set and collation are defined by the
 `character_set_connection' and `collation_connection' system variables.
 If you use `CAST()' with `CHARACTER SET X', then the resulting
 character set and collation are `X' and the default collation of `X'.
 
 You may not use a `COLLATE' clause inside a `CAST()', but you may use
 it outside. That is, `CAST(... COLLATE ...)' is illegal, but `CAST(...)
 COLLATE ...' is legal.
 
 Example:
 
      SELECT CAST(_latin1'test' AS CHAR CHARACTER SET utf8) COLLATE utf8_bin;
 
Info Catalog (mysql.info.gz) Charset-CONVERT (mysql.info.gz) Charset-operations (mysql.info.gz) Charset-SHOW
automatically generated byinfo2html