
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2009 03:34 PM
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?
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?
Labels:
- Labels:
-
Archive
5 REPLIES 5

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2009 09:29 PM
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
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

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2009 02:44 PM
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.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2009 10:41 AM
Your IP could end with .1 or .11 or .111, I'm not sure a right will do the trick

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2009 05:19 AM
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.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2009 09:22 PM
I think this will be very difficult in SQL to parse the IP address.
Some sort of vbscript will probably be easier.
Some sort of vbscript will probably be easier.
