TechTalk Genome v4.2

String.ToAnsi() Method

Converts Unicode string expressions to non-Unicode strings.

public string ToAnsi();
public string ToAnsi(
string codepage


A Microsoft SQL Server collation name used for non-Unicode strings. If omitted, the database default collation is used.

Return Value

A non-Unicode string value.


When the database schema uses both Unicode and non-Unicode fields and the default string encoding is Unicode, this method can be used to convert a Unicode string expression to non-Unicode, using the specified codepage. The method can be used with OQL expressions and is translated to a server-side T-SQL CAST or to a combination of a T-SQL COLLATE and CAST if the codepage is specified.

See Also

<StringEncoding> Element