Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have one table in sql that contain around 15000 rows...and there is one organisation column. In this column organisation name but some organisation name contain '-' (hyphen) after organition name now i want to remove all the value from '-' wherever it contain..

Example
ID Org_Name
1 A ltd
2 B ltd - blalalalal
3 C ltd
4 D ltd - blalalal
5 E ltd - blalalalalsdsds
6 F ltd
Posted
Comments
What have you tried?

The simplest way is to use: REPLACE[^] method.

SQL
UPDATE TableName SET ColumnName = REPLACE(ColumnName, '- ', '')
 
Share this answer
 
try this one buddy--

SQL
update  organisation set Org_Name=SUBSTRING(Org_Name,0,CHARINDEX('-',Org_Name)) where Org_Name like '%-%'
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900