Ravee123
asked on
Trim in T-sql
Hi
I have a column which has 'Ram, Rishi, Tapas'.
I want to display only Ram. How to trim after ram .
I have a column which has 'Ram, Rishi, Tapas'.
I want to display only Ram. How to trim after ram .
ASKER
Hi
That column has several data.
Ram, Rishi, Tapas
Stephen,Greek,John
Pathan, Doni, Sachin.
I want to display only the first value like
Ram
Stephen
Pathan
That column has several data.
Ram, Rishi, Tapas
Stephen,Greek,John
Pathan, Doni, Sachin.
I want to display only the first value like
Ram
Stephen
Pathan
That's a bit different from the OP, but this should help:
SUBSTRING(yourColumnName,1 ,CHARINDEX (',',yourC olumnName) -1)
SUBSTRING(yourColumnName,1
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SELECT LEFT(myColumn,3)
If it can be anywhere, something like this can help:
SELECT SUBSTRING(yourColumnName,C
If there are values that don't contain your text, you're going to have to handle them with a case statement.
Hope it helps.