:::: MENU ::::

Invalid length parameter passed to the %ls function.

  • Jun 30 / 2009
  • 0
dbDigger, System Functions

Invalid length parameter passed to the %ls function.

Following error message
Msg 536, Level 16, State 1, Line 3
Invalid length parameter passed to the %ls function.

is run time error message and appears on all versions of SQL Server, when you call a string function with an invalid length parameter. The invalid length parameter may be verified and corrected to solve the error.

Following is example of such error

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

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

Consult us to explore the Databases. Contact us