Click or drag to resize

SA0229 : This syntax of RAISERROR is discontinued. Rewrite the statement using the current RAISERROR(…) syntax or consider using THROW

The topic describes the SA0229 analysis rule.

Message

This syntax of RAISERROR is discontinued. Rewrite the statement using the current RAISERROR(…) syntax or consider using THROW

Description

The rule checks T-SQL code for usages of the deprecated RAISERROR syntax.

RAISERROR in the format RAISERROR integer 'string' is deprecated in SQL Server 2012 and discontinued in SQL Server 2014.

Rewrite the statement using the current RAISERROR(…) syntax or consider using THROW statement.

Scope

The rule has a Batch scope and is applied only on the SQL script.

Parameters

Rule has no parameters.

Remarks

The rule does not need Analysis Context or SQL Connection.

Categories

New Rules, Deprecated Features

Additional Information
Example Test Script
SQL
 1declare @errno int
 2declare @errmsg varchar(500)
 3select @errno=@@error
 4
 5if @errno<>0
 6begin
 7    select @errmsg='Error: '+ convert(varchar(10),@errno)
 8
 9    raiserror 200016 @errmsg
10
11    raiserror(@errmsg,200016,1)
12
13    return 1
14end

Analysis Results

 MessageLineColumn
1SA0229 : This syntax of RAISERROR is discontinued. Rewrite the statement using the current RAISERROR(…) syntax or consider using THROW.94
See Also

Other Resources