Sunday, May 29, 2022

Too many table names in the query. The maximum allowable is %d

 While using SQL Server 2005, You might have exceeded maximum allowed tables.

This time the error message was Too many table names in the query. The maximum allowable is 256.

Unfortunately, it’s not very feasible to reduce the number of tables being used as that number is dependent on the query.

Higher version of sql server is not having such problem.

SQL Error 105 : Unclosed quotation mark before the character string '%.*ls'

Msg 105, Level 15, State 1, Line n
Unclosed quotation mark before the character string '%.*ls'

The error msg indicate not correctly formatted string. In SQL Server it must be enclosed with single quotation mark (' '). 

SQL Server uses the single quote to delimit strings.  If the data itself contains a single quote you must pass in two single quotes in order for sql server to process the string correctly.

SELECT 'Hello

Output:

Msg 105, Level 15, State 1, Line 1
Unclosed quotation mark after the character string 'Hello
'.
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'Hello
'.

SELECT 'Hello'' World'''

Output:

Hello' World'