Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Stripping an IP Address field to get part of it...

Author  Topic 

jjz
Starting Member

31 Posts

Posted - 2010-07-14 : 02:32:27
Hi

May someone out there kindly assist.

I am trying to strip a field containing IP Addresses to only use part of it to compare it to another file with IP Addresses.

The raw data looks like this:
10.64.62.210
10.65.113.39
10.66.136.56
10.35.19.32
10.113.81.146


and ideally i would like to get the following results:

10.64.62
10.65.113
10.66.136
10.35.19
10.113.81

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-07-14 : 02:47:01
[code]select left(ip_addr, len(ip_addr) - charindex('.', reverse(ip_addr)))[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

jjz
Starting Member

31 Posts

Posted - 2010-07-14 : 02:54:23
thank you very much, :-)
Go to Top of Page
   

- Advertisement -