If all the messages are similar, then I would write a function that looks for the pattern:
… table ” — the word table, then a space, then a quote character
Then extract the following text up to the next quote character as the table name and repeat for the column name.
<pre>declare @i int;
declare @sTable varchar(255);
declare @sColumn varchar(255);
set @i = CHARINDEX( ‘table “‘, @sErrorMsg );
if @i > 0
begin
set @sTable = substring( @sErrorMsg, @i+7, 255 );
set @i = CHARINDEX( ‘”‘, @sTable );
if @i > 0
set @sTable = LEFT ( @sTable, @i – 1 );
end;</pre>
Discuss This Question: 1  Reply