Invalid length parameter passed to the %ls function.

Error Message:
Msg 536, Level 16, State 1, Line 3
Invalid length parameter passed to the %ls function.

Severity level:
16.

Description:
This error message appears, when you call a string function with an invalid length parameter.

Consequences:
The T-SQL statement can be parsed, but causes the error at runtime.

Resolution:
Error of the Severity Level 16 are generated by the user and can be fixed by the SQL Server user. The invalid length parameter must be corrected.

Versions:
All versions of SQL Server.

Example(s):
DECLARE @c VARCHAR(20)
SET @c = ‘Hello World’
SELECT SUBSTRING(@c, 1, -1)

Remarks:
The above example tries to extract a SUBSTRING of length -1 from the string @c. This raises the error.




Array

No comments yet... Be the first to leave a reply!