©SQL :: Manager
HomeProgram InformationTechnical detailsFree downloadDonate for a cup of coffee
myway SQL Manager for MySQL and MariaDB, Download on Uptodown
SQL functionMySQLMariaDB

The INET_NTOA SQL Function in MySQL and MariaDB - Convert integer to IP address

INET_NTOASyntax:INET_NTOA(Value)
Return value:CHAR
Function type:Miscellaneous function
Function Description

The INET_NTOA() function converts an integer "Value" to an IP address.

If the "Value" argument is invalid, the INET_NTOA() function returns a string containing "0.0.0.0".

If the "Value" argument is too large or NULL, the INET_NTOA() function returns NULL.

SQL Examples for the INET_NTOA function

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12

SELECT INET_NTOA(2130706433);
SELECT INET_NTOA(1123631620);

SELECT INET_NTOA('');
SELECT INET_NTOA(0);
SELECT INET_NTOA(1);

SELECT INET_NTOA('xxx.xxx.xxx.xxx');
SELECT INET_NTOA(52130706433);
SELECT INET_NTOA(null);

inet_ntoa(2130706433)
varchar(31) BINARY
127.0.0.1
inet_ntoa(1123631620)
varchar(31) BINARY
66.249.66.4
inet_ntoa('')
varchar(31) BINARY
0.0.0.0
INET_NTOA(0)
varchar(31) BINARY
0.0.0.0
INET_NTOA(1)
varchar(31) BINARY
0.0.0.1
INET_NTOA('xxx.xxx.xxx.xxx')
varchar(31) BINARY
0.0.0.0
INET_NTOA(52130706433)
varchar(31) BINARY
NULL
inet_ntoa(null)
varchar(31) BINARY
NULL
The examples were created with the MyWAY SQL manager: Download

How to use the INET_NTOA() function in MySQL and MariaDB databases

In MySQL and MariaDB the INET_NTOA() function can be used to convert an IPv4 address from its numeric form to its text representation. Te function takes a numeric value as an argument representing the IPv4 address and returns the corresponding IPv4 address in text format, for example for display purposes or to use in queries and comparisons to specific ranges filter or retrieve from IPv4 addresses. The text format is used to perform string operations or to extract specific parts of the address.
INET6_ATONINET6_NTOAINET_ATONINET_NTOAINSERTINSTRINTERVAL

Further MySQL und MariaDB SQL Miscellaneous functions

BIN_TO_UUIDBIN_TO_UUID(Binary string [, Swap])
More about BIN_TO_UUID Function

GET_LOCKGET_LOCK()

INET6_ATONINET6_ATON(String)
More about INET6_ATON Function

INET6_NTOAINET6_NTOA(Binary string)
More about INET6_NTOA Function

INET_ATONINET_ATON(String)
More about INET_ATON Function

IS_FREE_LOCKIS_FREE_LOCK()

IS_IPV4IS_IPV4(String)
More about IS_IPV4 Function

IS_IPV4_COMPATIS_IPV4_COMPAT(String)

IS_IPV4_MAPPEDIS_IPV4_MAPPED(String)

IS_IPV6IS_IPV6(String)
More about IS_IPV6 Function

IS_USED_LOCKIS_USED_LOCK()

IS_UUIDIS_UUID(String)
More about IS_UUID Function

MASTER_GTID_WAITMASTER_GTID_WAIT()

MASTER_POS_WAITMASTER_POS_WAIT()

NAME_CONSTNAME_CONST(Name, Value)
More about NAME_CONST Function

RELEASE_ALL_LOCKSRELEASE_ALL_LOCKS()

RELEASE_LOCKRELEASE_LOCK()

SYS_GUIDSYS_GUID()
More about SYS_GUID Function

UUIDUUID()
More about UUID Function

UUID_SHORTUUID_SHORT()
More about UUID_SHORT Function

UUID_TO_BINUUID_TO_BIN(String [, Swap])
More about UUID_TO_BIN Function

Numeric functionsString functionsRegular ExpressionsDate and Time functions
Comparison functionsEncryption & CompressionConversion functionsNULL functions
Aggregate functionsWindow functionsJSON functionsGeometric functions
Sequence functionsInformation functionsDynamic ColumnsMiscellaneous functions
More information about the INET_NTOA SQL function: mysql.com and mariadb.com
Updated: 2023-09-17ImprintContactTerms & conditionsPrivacy & CookiesUpdatesSitemapFacebookLinkedinTwitterStatistics©2020-2024 Heino Cunze-Fischer