xp_sscanf (Transact-SQL)
SQL Server 2012
Reads data from the string into the argument locations specified by each format argument.
The following example uses xp_sscanf to extract two values from a source string based on their positions in the format of the source string.
DECLARE @filename varchar (20), @message varchar (20) EXEC xp_sscanf 'sync -b -fproducts10.tmp -rrandom', 'sync -b -f%s -r%s', @filename OUTPUT, @message OUTPUT SELECT @filename, @message
Here is the result set.
-------------------- -------------------- products10.tmp random