CHARINDEX and TRIM (in SQL Server at least) do two different things.
CHARINDEX finds an occurance of one string in another. In my query, I use it to find where the first '(' was and just take the first part of the value up to that point (using the LEFT or SUBSTRING function).
LTRIM/RTRIM get rid of leading/trailing spaces from a value. In SQL Server, there is no TRIM function.
It looks like you need to find a function which does the same as the CHARINDEX function. Let us know if you come up with one.
But using this seems a horribly ugly solution to your problem, makes maintenance hard (what happens when another colour comes up?) and - most of all - will perform badly.
SUBSTRING(column_reference or string constant FROM start_index [FOR length])
POS(string constant IN column_reference or string constant)
REPLACE(string constant WITH new string constant IN
column_reference or string constant)
Tip: search on the web 'dbisam susbtring' to find a manual, documentation or examples. I found the above here
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.