SQL Server Errors

ORDER BY items must appear in the select list if SELECT DISTINCT is specified.

Error Message: Msg 145, Level 15, State 1, Line 1ORDER BY items must appear in the select list if SELECT DISTINCT is specified. Severity level: 15. Description:This error message appears when you try to execute a SELECT DISTINCT Statement that should be sorted by a column, which does not appear in the SELECT list. Consequences:The […]

The column prefix ‘%.*ls’ does not match with a table name or alias name used in the query.

Error Message: Server: Msg 107, Level 16, State 3, Line 1The column prefix ‘t1′ does not match with a table name or alias name used in the query. Severity level: 16. Description:SQL Server allows to specify a table alias for each table involved in your query. Typically this is in the formSELECT < list >  […]

Must declare the variable ‘%.*ls’.

Error Message: Server: Msg 137, Level 15, State 2, Line 3Must declare the variable ‘@orderid’. Severity level: 15. Description:SQL Server allows to use variables in SQL scripts or statements. This error is raised when you refer to a variable without having it declared first.    Consequences:The SQL statement cannot be parsed and further execution is stopped. […]

The ORDER BY position number %ld is out of range of the number of items in the select list.

Error Message: Server: Msg 108, Level 15, State 1, Line nThe ORDER BY position number x is out of range of the number of items in the select list. Severity level: 15. Description:SQL Server allows to reference a column in the ORDER BY clause by its ordinal position in the final resultset. This message appears when […]

Unclosed quotation mark before the character string ‘%.*ls’.

Error Message: Server: Msg 105, Level 15, State 1, Line nUnclosed quotation mark before the character string ‘%.*ls’. Severity level: 15. Description:This error message indicate a not correctly formatted string. Strings in SQL Server must always be enclosed in single quotation marks. If there are single quotation marks within the string itself, they need to […]

Line %d: Incorrect syntax near ‘%.*ls’.

Error Message: Server: Msg 170, Level 15, State 1, Line %dLine %d: Incorrect syntax near ‘%.*ls’. or:Server: Msg 102, Level 15, State 1, Line %dIncorrect syntax near ‘%.*ls’. Severity level: 15. Description:This error message appears when the parser encounters invalid syntax. Consequences:The SQL statement cannot be parsed and further execution is stopped. Resolution:Error of the […]
Software Reviews | Book Reviews | FAQs | Tips | Articles | Performance Tuning | Audit | BI | Clustering | Developer | Reporting | DBA | ASP.NET Ado | Views tips | | Developer FAQs | Replication Tips | OS Tips | Misc Tips | Index Tuning Tips | Hints Tips | High Availability Tips | Hardware Tips | ETL Tips | Components Tips | Configuration Tips | App Dev Tips | OLAP Tips | Admin Tips | Software Reviews | Error | Clustering FAQs | Performance Tuning FAQs | DBA FAQs |