fn_Get_Text_Before_Token
fn_Get_Text_Before_Token scans a string for a first occurance of a text token and returns a substring preceeding the given token.
Remarks
This function searches a given string (i.e. e-mail body) for first occurance of a given text token. If a token can not be found an entire string to search is returned, otherwise the substring prceeding a text token is returned.
[important]The function only returns top 8000 characters of a result string[/important]
Syntax
[set @s = ] dbo.fn_Get_Text_Before_Token ( @body ) |
Parameters
Column | Data Type | Direction | Description | Default | Status |
@text | text | in | string to search (typically an e-mail body) | Required | |
@token | varchar(250) | in | searched string (a token) | Required |
Return Values
returns varchar(8000)
Examples
Find specific tear line token inside body of an incoming e-mail.
-------Sample--------- declare @Key1 uniqueidentifier, @Key3 uniqueidentifier, @Key3 uniqueidentifier, @txt varchar(8000), @rKey uniqueidentifier /* .... some code ... */ select @txt = dbo.fn_Get_Text_Before_Token(Body,'--- separator ---') from IN_EMAIL where rKey=@rKey /* .... some code ... */ |