I have been trying to create a rule for the generation of the system username that takes into account the firstname with multiple values, for example:
firstname: Jean Pierre
System Username: Jean
What I am trying to achieve is to find a way to separate these two names to generate the system username, so that the system username is only 'Jean'.
But when I try to test with the following SQL query:
SUBSTRING(users.firstname , CHARINDEX(' ', users.firstname) + 1, LEN(users.firstname ))
I receive the following error: Operation not allowed as you are entering a value that resembles or contains script code
Any help is welcome in order to achieve this.
Solved! Go to Solution.
The SQL query you’re using is trying to get the substring after the first space, which is why you’re getting ‘Pierre’ instead of ‘Jean’. If you want to get the substring before the first space (i.e., the first name), you can modify your query as follows:
SUBSTRING_INDEX(users.firstname, ' ', 1)
SUBSTRING(users.firstname, 1, CHARINDEX(' ', users.firstname) - 1)
Thank you very much for your reply!
I had made a mistake when copying the query, you are right.
I think it was previously failing due the use of the 'LEN()' function, but im not sure.
Is there a list of all SQL functions allowed in EIC?