©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_ATON SQL Function in MySQL and MariaDB - Convert IP address to integer

INET_ATONSyntax:INET_ATON(String)
Return value:INTEGER
Function type:Miscellaneous function
Function Description

The INET_ATON() function returns an integer representing the numeric value of the IP address in "String".

If the value of "String" is invalid or NULL, the INET_ATON() function returns NULL.

SQL Examples for the INET_ATON function

 1
 2
 3
 4
 5
 6
 7
 8

SELECT INET_ATON('127.0.0.1');
SELECT INET_ATON('66.249.66.4');

SELECT INET_ATON('257.0.0.1');
SELECT INET_ATON('');
SELECT INET_ATON(null);

inet_aton('127.0.0.1')
bigint(21)
2130706433
inet_aton('66.249.66.4')
bigint(21)
1123631620
inet_aton('257.0.0.1')
bigint(21)
NULL
inet_aton('')
bigint(21)
NULL
inet_aton(null)
bigint(21)
NULL
The examples were created with the MyWAY SQL manager: Download

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

The INET_ATON() function in MySQL and MariaDB is used to convert an IPv4 address from its text representation to its numeric form. The function takes an IPv4 address in its text format as an argument and returns an integer value representing the numeric value of the IPv4 address, suitable for storage in a binary table columns or in comparisons or queries to filter or retrieve specific ranges of IPv4 addresses can be used. By converting IPv4 addresses to their numeric form, calculations or operations can be performed on them, for example to create subnets or extract certain parts of the address.
IFNULLINET6_ATONINET6_NTOAINET_ATONINET_NTOAINSERTINSTR

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_NTOAINET_NTOA(Value)
More about INET_NTOA 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_ATON SQL function: mysql.com and mariadb.com
Updated: 2023-09-17ImprintContactTerms & conditionsPrivacy & CookiesUpdatesSitemapFacebookLinkedinTwitterStatistics©2020-2024 Heino Cunze-Fischer