SQL Server Script To Locate Subnets Between Two Given Values

 

This SQL server script will find all of the subnets between two given values that your SMS network discovery has located.

To use this query change the IP octets to the location holders with the subnets that you want to display the values between. For example if you know that you have the SMS subnet boundaries 192.168.102.0 and 192.168.107.0 defined as subnet boundaries for your site you can add the values below to the script:

Where (Ip_Subnets0 > '192.168.99.0' And Ip_Subnets0 < '192.168.110.0')

This will return all the subnets between 100 and 109 that the SMS network discovery process has identified as active or in use. If the subnets 104 and 108 appear in the results pane then you should investigate the reasons why these particular subnets are not boundaries within your SMS site.

SQL Query:


Set NoCount On

 

Select Distinct

Subnets.Ip_Subnets0 Results

From System_Disc

Join System_Ip_Subnets_Arr as Subnets

On System_Disc.ItemKey = Subnets.ItemKey

Where (Ip_Subnets0 > '192.168.0.1'

And Ip_Subnets0 < '192.168.1.254')

 

Set NoCount Off

 

Published Sunday, July 29, 2007 2:06 PM by dhite
Filed under:

Comments

No Comments