Community FAQ
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
dteague
Engaged Sweeper III
I'm hoping someone can help me, as it has been years since I have done much in SQL. What I need is a list of computers that their name does not match their IP address's 4th node.

i.e. ABCCOMP043 should have an IP address of 10.0.0.43 if it had an address of 10.0.0.44 I would want it to show so I can rename the computer. Can someone help me out?
5 REPLIES 5
dteague
Engaged Sweeper III
Nevermind, I download Toad and was able to use it to debug my query and got something that will work for me...

SELECT
tblComputers.Computername,
tblComputers.LastknownIP AS [IP Address]
FROM
tblComputers
WHERE
NOT RTRIM(RIGHT(tblComputers.Computername,1)) = RTRIM(RIGHT(tblComputers.LastknownIP,1)) AND tblcomputers.LastknownIP > '10.0.' AND ISNUMERIC(RTRIM(RIGHT(tblComputers.Computername,1)))=1
dteague
Engaged Sweeper III
my thought would be to start more of a right(computername,1) = right(IPaddress,1). Yeah, if the computername was ABCCOMP111 and it's IP was 10.0.0.1 it would match, but I could live with that, I'm trying to determine what machines don't match their IP so we can change them, and anything I can do to help identify them in Lansweeper is great.
Hemoco
Lansweeper Alumni
Your IP could end with .1 or .11 or .111, I'm not sure a right will do the trick
dteague
Engaged Sweeper III
Is there not a way I could do a right(computername,3) = right(IPaddress,3) or something? even if it was only the last character of each that would be helpful for what I need. I'd not get if it when from .43 to .53 but would help.
Hemoco
Lansweeper Alumni
I think this will be very difficult in SQL to parse the IP address.
Some sort of vbscript will probably be easier.

Archive

This board contains archived posts from the retired Lansweeper Forum and Insiders Community.

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now