Created
July 17, 2018 17:19
-
-
Save h3nryza/0c895dfeb1d14a47f5b3924c23b9863f to your computer and use it in GitHub Desktop.
Substring of IP Address in Sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SQL Calculate IP Subnet | |
(charindex ( '.' , CMP.IPAddress ,charindex( '.' , CMP.IPAddress ,(charindex('.',CMP.IPAddress) +1 ) ) +1)-1) | |
SQL Spit out SQL Subnet | |
SUBSTRING( | |
CMP.IPAddress, | |
0, | |
(charindex ( '.' , CMP.IPAddress ,charindex( '.' , CMP.IPAddress ,(charindex('.',CMP.IPAddress) +1 ) ) +1)) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment