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 |
|
harlingtonthewizard
Constraint Violating Yak Guru
352 Posts |
Posted - 2008-10-27 : 01:35:21
|
| I tried this approach but I always seem to get what looks like a space on the end? I am guessing the character is not a space because the trim should remove if it was? Need to accomodate for an IP upto the full 15 characters. I was hoping to get the 15 chars and then just trim the spaces from each end.Create Table #t([IPA] nvarchar(100))Insert into #t** I am using execmaster with xp cmdshell and ipconfig here, cannot copy this line in for some reason web page gives error?***Select dbo.Trim (Right([IPA],16)) AS IPAFrom #tWhere IPA LIKE '%IP ADDRESS%' |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-27 : 01:40:13
|
| TRIM removes only soft space. If its not removing then it might be a hard space or some unprintable characters.what does below return?[code]SELECT ASCII(RIGHT(yourcol,1)) FROM Table[/code |
 |
|
|
harlingtonthewizard
Constraint Violating Yak Guru
352 Posts |
Posted - 2008-10-27 : 01:42:47
|
It Returns 13. So this seems to fix unless there is a better way of getting IP Address?Select dbo.Trim (REPLACE(Right([IPA],16),CHAR(13), '')) AS IPAquote: Originally posted by visakh16 TRIM removes only soft space. If its not removing then it might be a hard space or some unprintable characters.what does below return?[code]SELECT ASCII(RIGHT(yourcol,1)) FROM Table[/code
|
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-27 : 02:15:02
|
| so its not a space. its a carriage return character. just use REPLACE as you posted. that should do trick for you |
 |
|
|
|
|
|