Possible Duplicate:
How can I rearrange string with SQL?
Declare @CustTotalCount as int
Declare @CustMatchCount as int
select @CustTotalCount = count(*) from ENG_CUSTOMERTALLY
select @CustMatchCount = count(*) from Task where MPDReference in(
select ENG_CUSTOMERTALLY_CUSTOMERTASKNUMBER from dbo.ENG_CUSTOMERTALLY)
if(@CustTotalCount>@CustMatchCount)
select distinct
substring(ENG_CUSTOMERMYCROSS_MYTECHNIC_TASK_NO, charindex('-', ENG_CUSTOMERMYCROSS_MYTECHNIC_TASK_NO)
+ 1, 1000)
from dbo.ENG_CUSTOMERMYCROSS where
ENG_CUSTOMERMYCROSS_CUSTOMER_NUMBER in(
select ENG_CUSTOMERTALLY_CUSTOMERTASKNUMBER from ENG_CUSTOMERTALLY1
except
select MPDReference from Task )
i can convert below string data
- A320-200001-01-1(1)
- A320-200001-01-1(2)
- A320-200001-01-1(1)
TO
- 200001-01-1(1)
- 200001-01-1(2)
- 200001-01-1(1)
But i need
- 200001-01-1
- 200001-01-1
- 200001-01-1
distict ---> 200001-01-1 How can i do that SQL and C# ?