SQL Server error code
SQL Server error 137
SQL Server raises error 137 at severity 15, which marks a problem with the query or data that you can correct.
Must declare the scalar variable "%.*ls".
| Msg | 137 |
|---|---|
| Name | P_SCALAR_VAR_NOTFOUND |
| Severity | 15 |
| Group | 0–999 |
What it means
This error occurs when a variable is used in a SQL script without first declaring the variable. The following example returns error 137 for both the SET and SELECT statements because \@mycol is not declared.