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
 General SQL Server Forums
 New to SQL Server Programming
 Taking out << in a field

Author  Topic 

gemispence
Yak Posting Veteran

71 Posts

Posted - 2006-02-17 : 09:59:32
I'm performing an insert and I not only need to remove the << character, but also need to take one field and dump it into two fields. So in essence -

KAREL>>MONTES

needs to look like

Col1 Col2
Karel Montes

Thanks :)

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-02-17 : 10:21:52

declare @s varchar(100)
set @s='KAREL>>MONTES'
select SUBSTRING(@s,1,charindex('>>',@s)-1) as col1,SUBSTRING(@s,charindex('>>',@s)+2,len(@s))as col2

Madhivanan

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

- Advertisement -