If I have a string such as:
one\two\three\four\five\six\
two\three\four\five\six\one\
three\four\five\six\one\two\
four
five\six
How do I trim it so I only end up with
one
two
three
four
five
I have tried
LEFT(column_name_goes_here, CHARINDEX('\', column_name_goes_here) - 1)
Based on the answer from SQL Server replace, remove all after certain character
But it gives me the following error message:
Msg 537, Level 16, State 3, Procedure stored_procedure_one, Line 107
Invalid length parameter passed to the LEFT or SUBSTRING function.