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.
| Author |
Topic |
|
mike13
Posting Yak Master
219 Posts |
Posted - 2006-06-21 : 07:45:13
|
| Hi all,I got an ip 128.13.132.1How do i cut this string in SQL to look like this128.13.132. ?Thanks a lot,Roland |
|
|
mwjdavidson
Aged Yak Warrior
735 Posts |
Posted - 2006-06-21 : 08:21:23
|
Try:DECLARE @str VARCHAR(20)SET @str = '128.13.132.1'SELECT LEFT(@str, LEN(@str) - CHARINDEX('.', REVERSE(@str))+1)Mark |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-06-21 : 08:46:16
|
| If there are always four parts, thenSelect parsename(@str,4)+'.'+parsename(@str,3)+'.'+parsename(@str,2)MadhivananFailing to plan is Planning to fail |
 |
|
|
mike13
Posting Yak Master
219 Posts |
Posted - 2006-06-21 : 09:05:03
|
| Thanks a lot guys that did the job!! |
 |
|
|
|
|
|