On Transact SQL language the Msg 137 Level 15 - Must declare the scalar variable mean that the scalar variable is not declared or the variable name is misspelled or does not exist.
Msg 137 Level 15 Example:
Invalid statement:
USE model;
GO
SELECT @date AS 'My date';
GO
Message |
---|
Msg 137, Level 15, State 2, Line 1 |
Must declare the scalar variable "@date". |
Correct statement:
USE model;
GO
DECLARE @date date= '08-28-2014';
SELECT @date AS 'My date';
GO
My date |
---|
2014-08-28 |
Other error messages:
- There are more columns in the INSERT statement than values specified in the VALUES clause
- Is not a recognized datepart option
- The definition for column must include a data type
- Is not a recognized built-in function name
- Invalid column name
- Operand type clash: int is incompatible with date
- Invalid object name