fn_Get_Email_Key
fn_Get_Email_Key scans a string for a hash key.
Remarks
This function searches a given string (i.e. e-mail body) for first occurance of a hash key in a XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX form. If a key can not be found a null is returned.
[important]The function only searches the top 8000 characters of a given input string[/important]
Syntax
[set @s = ] dbo.fn_Get_Email_Key ( @body ) |
Parameters
Column | Data Type | Direction | Description | Default | Status |
@body | text | in | input string (typically an e-mail body) | Required |
Return Values
returns varchar(108)
Examples
Find job keys (OUT_EMAIL) inside body of an incoming e-mail.
---------Sample--------- declare @Key1 uniqueidentifier, @Key3 uniqueidentifier, @Key3 uniqueidentifier, @key varchar(108), @rKey uniqueidentifier /*.... my code ... */ select @key = dbo.fn_Get_Email_Key(Body) from IN_EMAIL where rKey=@rKey select @Key1 = substring(@key,1,36), @Key2 = substring(@key,37,36), @Key3 = substring(@key,73,36) /* .... my code ... */ |