61.7k views
4 votes
Invalid length parameter passed to the LEFT or SUBSTRING function (below)".

How can this be handled?

LEFT(U.FULLNAME,charindex(',', U.FULLNAME)- 1) AA, CHARINDEX(LEFT(U.FULLNAME,charindex(',', U.FULLNAME)- 1), P.Project_Name) CCOUNT

1 Answer

3 votes

This error occurs when the number of arguments sent to the function are not equal ( greater or less ) to the parameters of the function.

For example:

// if the function is

void a_function(int a, int b){

// does some computations

}

// Now when i will call it as

a_function(3);

// Same error as you are getting will occur because the function expects 2 //argements and i am passing one.

Same will happen if i will call it as:

a_function (1,2,3);

Here i am passing one extra argument.

So, i will suggest to count the left function parameters and the arguments you are passing here in this function and you will find the mistake.

User Duran Hsieh
by
5.6k points