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)
 replace nth occurrence with blank

Author  Topic 

Brittney10
Posting Yak Master

154 Posts

Posted - 2013-09-20 : 18:07:32
How do replace the 2nd occurrence of a character with an empty string? Example "1234/00/11/123456" would become "1234/0011/123456"

sigmas
Posting Yak Master

172 Posts

Posted - 2013-09-20 : 22:37:25
declare @v varchar(50) = '1234/00/11/123456'

select stuff(@v,charindex('/',@v,charindex('/',@v)+1),1,'');
Go to Top of Page
   

- Advertisement -