You are here: Functions > UNSIGNED()

UNSIGNED()

UNSIGNED() converts a number to an unsigned data type of a specified length.

Use UNSIGNED() to create numeric data in unsigned format. This may be required when creating data to be read by external applications. For information on the unsigned field type see Unsigned.

See PACKED(). For an alternative method of converting numeric data.

Function Format

UNSIGNED(N1,#)

UNSIGNED() converts N1 to UNSIGNED data of the byte length specified by #.

Note: Since the output from this function is not printable, you should generally include it only in conjunction with creating a file. A View will not show the data as you expect. In the examples below, results are expressed as hexadecimal strings.

Examples

UNSIGNED(75,3) = 000075

UNSIGNED(-75,3) = 000075

UNSIGNED(7.5,3) = 000075

UNSIGNED(12456,2) = 2456

If the length is too short to store the entire number, significant digits are truncated.

If N1 is negative, the minus sign is deleted. For example:

UNSIGNED(-12.456,6) = 000000012456