Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to seaprate valuve in column :
for example
12/34
1.5/24

required result
12
1.5

thx in advance

What I have tried:

PATINDEX('%[0-9][^0-9]%', ConcUnit)
Posted
Updated 26-Jan-17 21:19pm

1 solution

If you are using SQL Server 2016, go for STRING_SPLIT (Transact-SQL)[^]
else use a combination of LEFT (Transact-SQL)[^] and CHARINDEX (Transact-SQL)[^]
 
Share this answer
 
Comments
Master Vinu 27-Jan-17 3:35am    
Not working ..pls give syntex..thanks in advance
King Fisher 27-Jan-17 3:49am    
Just try once , use charindex to find the index of '/' character,
So you will get the index , Right?
Then use LEFT to split the value (0,index position which you got from charindex function)
Master Vinu 27-Jan-17 4:08am    
pls give syntex..thanks in advance
Afzaal Ahmad Zeeshan 27-Jan-17 4:04am    
5ed.
Master Vinu 27-Jan-17 4:08am    
pls give syntex..thanks in advance

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