January 27, 2012 at 3:43 am
Hello -
I need to get rid of white spaces in a blank cell in SQL table. I've used RTRIM & LTRIM functions but they are used in case of prefix or suffix of a cell value.
January 27, 2012 at 3:49 am
You can use both Rtrim and Ltrim at a time to get rid from both prefix and suffix.
Select Ltrim(rtrim(column))
January 27, 2012 at 3:54 am
that works..thaks a ton.
January 27, 2012 at 4:54 am
depending where your white space is you could use replace for example if you have a string
that looks like this 111 222 333 444 and you want it to look like this 111222333444
you can use replace
REPLACE ( string_expression , string_pattern , string_replacement )
code="other"]
Select replace (expression,' ','')[
[/code]
***The first step is always the hardest *******
January 27, 2012 at 4:57 am
this is happening in a null cell. A blank cell should show up as null but in this case the white space is represented as a value, which is skewing my resultant values.
January 27, 2012 at 8:01 am
Confused NUll is NULL but a space ' ' is a value so not sure where your coming from there however, if you want to eliminate collums that only have a blank space then you could do something like this
where COLUMN like '%[a-z,0-9]%'
***The first step is always the hardest *******
January 27, 2012 at 8:04 am
let me try if that works. BTW...when I view the blank cell it should give me the NULL value instead it shows that there is a value in it, but apparently its a white space.
I would try the function that you have mentioned.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply