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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 get rid of symbol character in the field

Author  Topic 

ntn104
Posting Yak Master

175 Posts

Posted - 2012-05-04 : 10:47:15
Hello,

How do I get rid of some symbol in front of the field name. For example:  ABCD, I just want to display ABCD only.

Thanks,

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-05-04 : 10:50:50
is it always the same symbol ? if it is so, you can use replace() to remove it


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

Go to Top of Page

ntn104
Posting Yak Master

175 Posts

Posted - 2012-05-04 : 11:02:56
yes it always symbol and space after...
and want to get rid space and that symbol...

Thanks,

quote:
Originally posted by khtan

is it always the same symbol ? if it is so, you can use replace() to remove it


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



Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-05-04 : 11:06:42
so the text that you want is starting from 3rd character ?

substring( <string> , 3, len(<string>) - 2)



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

Go to Top of Page

ntn104
Posting Yak Master

175 Posts

Posted - 2012-05-04 : 11:10:10
I got error message for this, like missing a parenthesis...st..
select substring(STREET_2 , 3, len(STREET_2) - 2))
from table

what I did wrong? thanks,

quote:
Originally posted by khtan

so the text that you want is starting from 3rd character ?

substring( <string> , 3, len(<string>) - 2)



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



Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-05-04 : 11:44:53
you have mismatched parenthesis.
See the extra one in red

select substring(STREET_2 , 3, len(STREET_2) - 2))
from table



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

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2012-05-07 : 07:10:34
Alternate

right(col,len(col)-2)

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

ntn104
Posting Yak Master

175 Posts

Posted - 2012-05-07 : 11:21:12
Thanks...it worked now...

quote:
Originally posted by khtan

you have mismatched parenthesis.
See the extra one in red

select substring(STREET_2 , 3, len(STREET_2) - 2))
from table



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



Go to Top of Page
   

- Advertisement -