SDU Tools: Check if an IP address is valid using T-SQL
Every now and again, I need to store IP address values in T-SQL and I want to check if the string that I’m passed is a valid IP address. So, in our free SDU Tools for developers and DBAs, we added a simple tool that works that out. It’s called IsIPv4Address.
You can tell by the name that it only works with IPv4 addresses, not IPv6.
Nothing complex. It takes a string, checks the format, and the range of octet values, and returns its verdict.
2019-09-11