declare @text varchar(8000), @InicialString as int, @finalString as int set @InicialString = LEN('<dhRecbto>') set @finalString = LEN('/<dhRecbto>') set @text = '..234823948239fsdfjdske3409......<dhRecbto>2012-05-21T09:31:24</dhRecbto>...vfdghjr0938dwefsdhfjkds...' select SUBSTRING( @text,charindex('<dhRecbto>' ,@text)+@InicialString, (LEN(@text)- CHARINDEX('</dhRecbto>',@text)-@InicialString - @finalString)+1 )
Eduardo Gomes - http://www.h1solucoes.com.br - Twitter: @edugp_sp