Click here to Skip to main content
15,882,113 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a field time_of_arrival there i am capturing hour and minutes the field name is fldarrival
(i.e)
08-44
8-45
10-5
10-05


Here i am writing query to split hour and minutes here only i am getting confusion. my query is :
SQL
select substring(fldarrival,1,2) as HH from dbo.CS_Initial_Assessment
select substring(fldarrival,3,2) as HH from dbo.CS_Initial_Assessment

my output is
HH  MM
08  44
8-  45
10  -5
10  05


Expected output:
HH  MM
08  44
 8  5
10  5
10  05

Here i want to remove special character. Can any one pls suggest how to go about it.

Regards,
Vinoth
Posted
Updated 11-Feb-13 1:29am
v2

Use REPLACE[^] instead of SUBSTRING:
SQL
SELECT REPLACE(fldarrival, '-', ' ') as HH FROM dbo.CS_Initial_Assessment
 
Share this answer
 
Comments
Maciej Los 11-Feb-13 7:30am    
Short and to the point, +5!
use replace function

eg.
SQL
select replace('08- 45','-','')


Happy Coding!
:)
 
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