Home > DeveloperSection > Forums > Remove all after certain character
Jeet Verma
Jeet Verma

Total Post:110

Points:776
Posted on    February-14-2013 1:24 AM

 C# C# 
Ratings:


 1 Reply(s)
 903  View(s)
Rate this:

Hi Everyone!

I have got a C# project and some data like:

Thinness (n.)
Slenderness (n.)
A fat lot
Hefty (a.)
Tucking of loincloth
I want these data just like that below

Thinness
Slenderness
A fat lot
Hefty
Tucking of loincloth
I tried

UPDATE    dic
SET  english = LEFT(english, CHARINDEX('(', english) - 1)
WHERE  (CHARINDEX('(', english) > 0)
But I get error:

Token in error LEFT

How can I handle that?

Thanks in advance



AVADHESH PATEL

Total Post:604

Points:4228
Posted on    February-16-2013 3:50 AM

Hi Jeet!

In place of LEFT used SUBSTRING as below

UPDATE    dic
SET  english = SUBSTRING(english, 1, CHARINDEX('(', english) - 1)
WHERE  (CHARINDEX('(', english) > 0)


Don't want to miss updates? Please click the below button!

Follow MindStick