Supported Adaptive Server datatypes

The Adaptive Server interface supports the SAP datatypes listed in the following table in DataWindow objects and embedded SQL.

Binary

NVarChar

BigInt (15.x and later)

Real

Bit

SmallDateTime

Char (see Column-length limits)

SmallInt

DateTime

SmallMoney

Decimal

Text

Double precision

Timestamp

Float

TinyInt

Identity

UniChar

Image

UniText (15.x and later)

Int

UniVarChar

Money

VarBinary

NChar

VarChar

Numeric

 


In Adaptive Server 15.0 and later, PowerBuilder supports unsigned as well as signed bigint, int, and smallint datatypes. You can also use the following datatypes as identity columns in Adaptive Server 15.0 and later: bigint, int, numeric, smallint, tinyint, unsigned bigint, unsigned int, and unsigned smallint.

Accessing Unicode data

PowerBuilder can connect, save, and retrieve data in both ANSI/DBCS and Unicode databases. When character data or command text is sent to the database, PowerBuilder sends a DBCS string if the UTF8 database parameter is set to 0 (the default). If UTF8 is set to 1, PowerBuilder sends a UTF-8 string. The database server must be configured correctly to accept UTF-8 strings. See the description of the UTF8 database parameter in the section called “UTF8” in Connection Reference.

The character set used by an Adaptive Server database server applies to all databases on that server. The nchar and nvarchar datatypes can store UTF-8 data if the server character set is UTF-8. The Unicode datatypes unichar and univarchar were introduced in Adaptive Server 12.5 to support Unicode data. Columns with these datatypes can store only Unicode data. Any data saved into such a column must be converted to Unicode explicitly. This conversion must be handled by the database server or client.

In Adaptive Server 12.5.1 and later, additional support for Unicode data has been added. For more information, see the documentation for your version of Adaptive Server.

Different display values in painters

The unichar and univarchar datatypes support UTF-16 encoding, therefore each unichar or univarchar character requires two bytes of storage. The following example creates a table with one unichar column holding 10 Unicode characters:

create table unitbl (unicol unichar(10))

In the Database painter, the column displays as unichar(20)because the column requires 20 bytes of storage. This is consistent with the way the column displays in SAP Central.

However, the mapping between the Type in the Column Specifications view in the DataWindow painter and the column datatype of a table in the database is not one-to-one. The Type in the Column Specifications view shows the DataWindow column datatype and DataWindow column length. The column length is the number of characters, therefore an Adaptive Server unichar(20)column displays as char(10) in the Column Specifications view.

Column-length limits

Adaptive Server 12.5 and earlier have a column-length limit of 255 bytes. Adaptive Server 12.5.x and later support wider columns for Char, VarChar, Binary, and VarBinary datatypes, depending on the logical page size and the locking scheme used by the server.

In PowerBuilder, you can use these wider columns for Char and VarChar datatypes with Adaptive Server 12.5.x when the following conditions apply:

  • The Release database parameter is set to 12.5 or higher.

  • You are accessing the database using Open Client 12.5.x or later.

The database must be configured to use a larger page size to take full advantage of the widest limits.

For more information about the Release database parameter, see "Release database parameter".

When you retrieve or update columns, PowerBuilder converts data appropriately between the Adaptive Server datatype and the PowerScript datatype. Similarly or identically named Adaptive Server and PowerScript datatypes do not necessarily have the same definitions. For information about the definitions of PowerScript datatypes, see the PowerScript Reference.

Conversion in PowerBuilder scripts

A double that has no fractional component is converted to a string with one decimal place if the converted string would cause Adaptive Server to have an overflow error when parsing the string. For example: the double value 12345678901234 would cause an overflow error, so PowerBuilder converts the double to the string value 12345678901234.0.