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 2005 Forums
 Transact-SQL (2005)
 Removing Characters

Author  Topic 

cable_si
Starting Member

20 Posts

Posted - 2008-09-12 : 09:22:04
Hi

I have a text field in a table in my database

at the end of the field is a full stop

eg "this is a bit of text."

i want to remove the full stops at the end from all records

Can anyone help me with the SQL to do this ?

thanks

Simon

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-09-12 : 09:28:31

select left(col,len(col)-1) as col from your_table


Madhivanan

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

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-09-12 : 09:29:20
[code]
update t
set col = left(col, len(col) - 1)
from yourtable
where right(col, 1) = '.'
[/code]


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

Go to Top of Page

cable_si
Starting Member

20 Posts

Posted - 2008-09-12 : 09:49:18
excellent, thanks
Go to Top of Page
   

- Advertisement -