You are on page 1of 3

MySQL vs NJ/NX series data format

Data type category Data type in DB Data type in NJ/NX-series Controllers


Numbers*15 BIT BOOL
BOOL BOOL

BOOLEAN
TINYINT SINT

USINT
SMALLINT INT

UINT
MEDIUMINT DINT

UDINT
INT DINT

UDINT
BIGINT LINT

ULINT

TIME
*16

DECIMAL(1) BOOL

DECIMAL(3) SINT

DECIMAL(5) INT

DECIMAL(10) DINT

DECIMAL(20) LINT

DECIMAL(3) USINT

DECIMAL(5) UINT

DECIMAL(10) UDINT

DECIMAL(20) ULINT
DECIMAL(20) TIME
FLOAT REAL

Page 1 of 3
Data type category Data type in DB Data type in NJ/NX-series Controllers
DOUBLE LREAL
Date and time DATE DATE
DATETIME DATE_AND_TIME
TIMESTAMP DATE_AND_TIME
TIME TIME_OF_DAY
String CHAR STRING*17
VARCHAR STRING*17
TINYTEXT STRING*17
TEXT STRING*17
MEDIUMTEXT STRING*17
LONGTEXT STRING*17
Binary BINARY None
VARBINARY None
TINYBLOB None
BLOB None
MEDIUMBLOB None
LONGBLOB None
Others ENUM None
YEAR None
SET None

*15
• The DECIMAL(p[ ,s]) is expressed in the short form where the number of digits
after the decimal point (s) is omitted. When the short form is used, the number of
digits after the decimal point (s) is 0. If the number of digits after the decimal point (s)
is not omitted and 1 or greater numerical value is set, only the integer portion of the
value is applicable.
*16

• Digit overflow may occur even in the above data types due to the difference in the
valid range.
• Example: When the data type in DB is DECIMAL(3) and the data type in NJ/NX-
series Controllers is USINT:
o DECIMAL(3)’s range: 0 to 999
o USINT’s range: 0 to 255

*17

A NULL character is attached to the end of each text string. Therefore, you need to
set the value that is one byte bigger than the number of bytes of the DB’s data type for
the number of bytes to be used in STRING data.

Page 2 of 3
You need to set an appropriate value for the number of bytes used in the STRING
data according to the data type and character code in the DB. In NJ/NX Series, text
strings are handled as UTF-8. One byte is used for each single-byte alphanumeric
character and multiple bytes are used for each multi-byte character. Three bytes are
used for each Japanese character as a guide.

Page 3 of 3

You might also like